/** * @param $imageorientConfig * @return array */ public function setImageorientItems(&$imageorientConfig) { $pageTsConfig = BackendUtility::getPagesTSconfig(GeneralUtility::_GET('id')); $pageTsConfig = GeneralUtility::removeDotsFromTS($pageTsConfig); if (array_key_exists('tx_customresponsiveimages', $pageTsConfig)) { $responsiveImageConfiguration = $pageTsConfig['tx_customresponsiveimages']; } else { $responsiveImageConfiguration = array(); } $groupedItems = array(); $i = 0; foreach ($responsiveImageConfiguration['items'] as $imageorient => $item) { $groupedItems[$item['group']][$i][] = $GLOBALS['LANG']->sL($item['label']); $groupedItems[$item['group']][$i][] = $imageorient; $groupedItems[$item['group']][$i][] = array_key_exists('icon', $item) && !empty($item['icon']) ? $responsiveImageConfiguration['seliconsPath'] . $item['icon'] : NULL; $i++; } $imageOrientItems = array(); foreach ($responsiveImageConfiguration['groups'] as $groupName => $group) { if (array_key_exists('label', $group) && !empty($group['label'])) { $imageOrientItems[] = array($GLOBALS['LANG']->sL($group['label']), '--div--'); } if (array_key_exists($groupName, $groupedItems)) { foreach ($groupedItems[$groupName] as $item) { array_push($imageOrientItems, $item); } } } $imageorientConfig['items'] = $imageOrientItems; }
/** * Executes an itemsProcFunc if defined in TCA and returns the combined result (predefined + processed items) * * @param string $table * @param int $pageId * @param string $field * @param array $row * @param array $tcaConfig The TCA configuration of $field * @param array $selectedItems The items already defined in the TCA configuration * @return array The processed items (including the predefined items) */ public function getProcessingItems($table, $pageId, $field, $row, $tcaConfig, $selectedItems) { $pageId = $table === 'pages' ? $row['uid'] : $row['pid']; $TSconfig = BackendUtility::getPagesTSconfig($pageId); $fieldTSconfig = $TSconfig['TCEFORM.'][$table . '.'][$field . '.']; $params = []; $params['items'] =& $selectedItems; $params['config'] = $tcaConfig; $params['TSconfig'] = $fieldTSconfig['itemsProcFunc.']; $params['table'] = $table; $params['row'] = $row; $params['field'] = $field; // The itemsProcFunc method may throw an exception. // If it does display an error message and return items unchanged. try { GeneralUtility::callUserFunction($tcaConfig['itemsProcFunc'], $params, $this); } catch (\Exception $exception) { $languageService = $this->getLanguageService(); $fieldLabel = $field; if (isset($GLOBALS['TCA'][$table]['columns'][$field]['label'])) { $fieldLabel = $languageService->sL($GLOBALS['TCA'][$table]['columns'][$field]['label']); } $message = sprintf($languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:error.items_proc_func_error'), $fieldLabel, $exception->getMessage()); /** @var FlashMessage $flashMessage */ $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $message, '', FlashMessage::ERROR, true); /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($flashMessage); } return $selectedItems; }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { $this->id = intval(GeneralUtility::_GET('id')); $this->tsParser = new TsParserUtility(); // Get extension configuration /** @var \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility $configurationUtility */ $configurationUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility'); $extensionConfiguration = $configurationUtility->getCurrentConfiguration('themes'); // Initially, get configuration from extension manager! $extensionConfiguration['categoriesToShow'] = GeneralUtility::trimExplode(',', $extensionConfiguration['categoriesToShow']['value']); $extensionConfiguration['constantsToHide'] = GeneralUtility::trimExplode(',', $extensionConfiguration['constantsToHide']['value']); // mod.tx_themes.constantCategoriesToShow.value // Get value from page/user typoscript $externalConstantCategoriesToShow = $this->getBackendUser()->getTSConfig('mod.tx_themes.constantCategoriesToShow', BackendUtility::getPagesTSconfig($this->id)); if ($externalConstantCategoriesToShow['value']) { $this->externalConfig['constantCategoriesToShow'] = GeneralUtility::trimExplode(',', $externalConstantCategoriesToShow['value']); $extensionConfiguration['categoriesToShow'] = array_merge($extensionConfiguration['categoriesToShow'], $this->externalConfig['constantCategoriesToShow']); } // mod.tx_themes.constantsToHide.value // Get value from page/user typoscript $externalConstantsToHide = $this->getBackendUser()->getTSConfig('mod.tx_themes.constantsToHide', BackendUtility::getPagesTSconfig($this->id)); if ($externalConstantsToHide['value']) { $this->externalConfig['constantsToHide'] = GeneralUtility::trimExplode(',', $externalConstantsToHide['value']); $extensionConfiguration['constantsToHide'] = array_merge($extensionConfiguration['constantsToHide'], $this->externalConfig['constantsToHide']); } $this->allowedCategories = $extensionConfiguration['categoriesToShow']; $this->deniedFields = $extensionConfiguration['constantsToHide']; // initialize normally used values }
/** * Returns RichTextElement as class name if RTE widget should be rendered. * * @return string|void New class name or void if this resolver does not change current class name. */ public function resolve() { $table = $this->data['tableName']; $fieldName = $this->data['fieldName']; $row = $this->data['databaseRow']; $parameterArray = $this->data['parameterArray']; $backendUser = $this->getBackendUserAuthentication(); if (!$parameterArray['fieldConf']['config']['readOnly'] && $backendUser->isRTE()) { // @todo: Most of this stuff is prepared by data providers within $this->data already $specialConfiguration = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']); // If "richtext" is within defaultExtras if (isset($specialConfiguration['richtext'])) { // Operates by reference on $row! 'pid' is changed ... BackendUtility::fixVersioningPid($table, $row); list($recordPid, $tsConfigPid) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']); // If the pid-value is not negative (that is, a pid could NOT be fetched) if ($tsConfigPid >= 0) { // Fetch page ts config and do some magic with it to find out if RTE is disabled on TS level. $rteSetup = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($recordPid)); $rteTcaTypeValue = $this->data['recordTypeValue']; $rteSetupConfiguration = BackendUtility::RTEsetup($rteSetup['properties'], $table, $fieldName, $rteTcaTypeValue); if (!$rteSetupConfiguration['disabled']) { // Finally, we're sure the editor should really be rendered ... return RichtextElement::class; } } } } return null; }
/** * Generate a different preview link * * @param string $status status * @param string $table table name * @param integer $recordUid id of the record * @param array $fields fieldArray * @param \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject parent Object * @return void */ public function processDatamap_afterDatabaseOperations($status, $table, $recordUid, array $fields, \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject) { // Clear category cache if ($table === 'sys_category') { /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */ $cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('cache_news_category'); $cache->flush(); } // Preview link if ($table === 'tx_news_domain_model_news') { // direct preview if (!is_numeric($recordUid)) { $recordUid = $parentObject->substNEWwithIDs[$recordUid]; } if (isset($GLOBALS['_POST']['_savedokview_x']) && !$fields['type']) { // If "savedokview" has been pressed and current article has "type" 0 (= normal news article) $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']); if ($pagesTsConfig['tx_news.']['singlePid']) { $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('tx_news_domain_model_news', $recordUid); $parameters = array('no_cache' => 1, 'tx_news_pi1[controller]' => 'News', 'tx_news_pi1[action]' => 'detail', 'tx_news_pi1[news_preview]' => $record['uid']); if ($record['sys_language_uid'] > 0) { if ($record['l10n_parent'] > 0) { $parameters['tx_news_pi1[news_preview]'] = $record['l10n_parent']; } $parameters['L'] = $record['sys_language_uid']; } $GLOBALS['_POST']['popViewId_addParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $parameters, '', FALSE, TRUE); $GLOBALS['_POST']['popViewId'] = $pagesTsConfig['tx_news.']['singlePid']; } } } }
/** * Administrative links for a table / record * * @param string $table Table name * @param array $row Record for which administrative links are generated. * * @return string HTML link tags. */ public function adminLinks($table, array $row) { if ($table !== 'tx_commerce_products') { return parent::adminLinks($table, $row); } else { $language = $this->getLanguageService(); // Edit link: $adminLink = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick('&edit[' . $table . '][' . $row['uid'] . ']=edit', $this->doc->backPath)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->sL('LLL:EXT:lang/locallang_core.xml:cm.edit', TRUE))) . '</a>'; // Delete link: $adminLink .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->sL('LLL:EXT:lang/locallang_core.php:cm.delete', TRUE))) . '</a>'; if ($row['pid'] == -1) { // get page TSconfig $pagesTyposcriptConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']); if ($pagesTyposcriptConfig['tx_commerce.']['singlePid']) { $previewPageId = $pagesTyposcriptConfig['tx_commerce.']['singlePid']; } else { $previewPageId = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['extConf']['previewPageID']; } $sysLanguageUid = (int) $row['sys_language_uid']; /** * Product * * @var $product Tx_Commerce_Domain_Model_Product */ $product = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Product', $row['t3ver_oid'], $sysLanguageUid); $product->loadData(); $getVars = ($sysLanguageUid > 0 ? '&L=' . $sysLanguageUid : '') . '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'] . '&no_cache=1&tx_commerce_pi1[showUid]=' . $product->getUid() . '&tx_commerce_pi1[catUid]=' . current($product->getMasterparentCategory()); $adminLink .= '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($previewPageId, $this->doc->backPath, \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } return $adminLink; } }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { $this->id = intval(GeneralUtility::_GET('id')); $this->tsParser = new TsParserUtility(); // extension configuration $extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['themes']); $extensionConfiguration['categoriesToShow'] = GeneralUtility::trimExplode(',', $extensionConfiguration['categoriesToShow']); $extensionConfiguration['constantsToHide'] = GeneralUtility::trimExplode(',', $extensionConfiguration['constantsToHide']); // mod.tx_themes.constantCategoriesToShow.value $externalConstantCategoriesToShow = $GLOBALS['BE_USER']->getTSConfig('mod.tx_themes.constantCategoriesToShow', BackendUtility::getPagesTSconfig($this->id)); if ($externalConstantCategoriesToShow['value']) { $this->externalConfig['constantCategoriesToShow'] = GeneralUtility::trimExplode(',', $externalConstantCategoriesToShow['value']); ArrayUtility::mergeRecursiveWithOverrule($extensionConfiguration['categoriesToShow'], $this->externalConfig['constantCategoriesToShow']); } else { $this->externalConfig['constantCategoriesToShow'] = array(); } // mod.tx_themes.constantsToHide.value $externalConstantsToHide = $GLOBALS['BE_USER']->getTSConfig('mod.tx_themes.constantsToHide', BackendUtility::getPagesTSconfig($this->id)); if ($externalConstantsToHide['value']) { $this->externalConfig['constantsToHide'] = GeneralUtility::trimExplode(',', $externalConstantsToHide['value']); ArrayUtility::mergeRecursiveWithOverrule($extensionConfiguration['constantsToHide'], $this->externalConfig['constantsToHide']); } else { $this->externalConfig['constantsToHide'] = array(); } $this->allowedCategories = $extensionConfiguration['categoriesToShow']; $this->deniedFields = $extensionConfiguration['constantsToHide']; // initialize normally used values }
/** * This method is called by a hook in the TYPO3 core when a record is saved. * * We use the tx_linkhandler for backend "save & show" button to display records on the configured detail view page. * * @param string $status Type of database operation i.e. new/update. * @param string $table The table currently being processed. * @param integer $id The records id (if any). * @param array $fieldArray The field names and their values to be processed (passed by reference). * @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj Reference to the parent object. */ public function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $pObj) { if (isset($GLOBALS['_POST']['_savedokview_x'])) { $settingFound = FALSE; $currentPageId = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($GLOBALS['_POST']['popViewId']); $rootPageData = $this->getRootPage($currentPageId); $defaultPageId = isset($rootPageData) && array_key_exists('uid', $rootPageData) ? $rootPageData['uid'] : $currentPageId; $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($currentPageId); $handlerConfigurationStruct = $pagesTsConfig['mod.']['tx_linkhandler.']; // search for the current setting for given table foreach ($pagesTsConfig['mod.']['tx_linkhandler.'] as $key => $handler) { if (is_array($handler) && $handler['listTables'] === $table) { $settingFound = TRUE; $selectedConfiguration = $key; break; } } if ($settingFound) { $l18nPointer = array_key_exists('transOrigPointerField', $GLOBALS['TCA'][$table]['ctrl']) ? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] : ''; if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) { $id = $pObj->substNEWwithIDs[$id]; } if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) { $recordArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $id); } else { $recordArray = $fieldArray; } if (array_key_exists('previewPageId', $handlerConfigurationStruct[$selectedConfiguration]) && \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($handlerConfigurationStruct[$selectedConfiguration]['previewPageId']) > 0) { $previewPageId = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($handlerConfigurationStruct[$selectedConfiguration]['previewPageId']); } else { $previewPageId = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($defaultPageId); } if ($GLOBALS['BE_USER']->workspace != 0) { $timeToLiveHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')) ? intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')) : 24 * 2; $wsPreviewValue = ';' . $GLOBALS['BE_USER']->workspace . ':' . $GLOBALS['BE_USER']->user['uid'] . ':' . 60 * 60 * $timeToLiveHours; // get record UID for if (array_key_exists($l18nPointer, $recordArray) && $recordArray[$l18nPointer] > 0 && $recordArray['sys_language_uid'] > 0) { $id = $recordArray[$l18nPointer]; } elseif (array_key_exists('t3ver_oid', $recordArray) && intval($recordArray['t3ver_oid']) > 0) { // this makes no sense because we already receive the UID of the WS-Placeholder which will be the real record in the LIVE-WS $id = $recordArray['t3ver_oid']; } } else { $wsPreviewValue = ''; if (array_key_exists($l18nPointer, $recordArray) && $recordArray[$l18nPointer] > 0 && $recordArray['sys_language_uid'] > 0) { $id = $recordArray[$l18nPointer]; } } $previewDomainRootline = \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($previewPageId); $previewDomain = \TYPO3\CMS\Backend\Utility\BackendUtility::getViewDomain($previewPageId, $previewDomainRootline); $linkParamValue = 'record:' . $table . ':' . $id; $queryString = '&eID=linkhandlerPreview&linkParams=' . urlencode($linkParamValue . $wsPreviewValue); $languageParam = '&L=' . $recordArray['sys_language_uid']; $queryString .= $languageParam . '&authCode=' . \TYPO3\CMS\Core\Utility\GeneralUtility::stdAuthCode($linkParamValue . $wsPreviewValue . intval($recordArray['sys_language_uid']), '', 32); $GLOBALS['_POST']['viewUrl'] = $previewDomain . '/index.php?id=' . $previewPageId . $queryString . '&y='; $GLOBALS['_POST']['popViewId_addParams'] = $queryString; } } }
/** * Get template layouts defined in TsConfig * * @param $pageUid * @return array */ protected function getTemplateLayoutsFromTsConfig($pageUid) { $templateLayouts = array(); $pagesTsConfig = BackendUtility::getPagesTSconfig($pageUid); if (isset($pagesTsConfig['tx_news.']['templateLayouts.']) && is_array($pagesTsConfig['tx_news.']['templateLayouts.'])) { $templateLayouts = $pagesTsConfig['tx_news.']['templateLayouts.']; } return $templateLayouts; }
/** * Get template layouts defined in TsConfig * * @param $pageUid * @return array */ protected function getTemplateLayoutsFromTsConfig($pageUid) { $templateLayouts = array(); $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pageUid); if (isset($pagesTsConfig['tx_jhmagnificpopup.']['mainClass.']) && is_array($pagesTsConfig['tx_jhmagnificpopup.']['mainClass.'])) { $templateLayouts = $pagesTsConfig['tx_jhmagnificpopup.']['mainClass.']; } return $templateLayouts; }
public function execute() { $event = BackendUtility::getRecord('tx_cal_event', $this->uid); $select = '*'; $table = 'tx_cal_fe_user_event_monitor_mm'; $where = 'schedulerId = ' . $this->getTaskUid(); $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where); $eventMonitor = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); if (!is_array($event)) { // the event could not be found, so we delete this reminder $this->remove(); return true; } // ****************** // Constants defined // ****************** define('PATH_thisScript', str_replace('//', '/', str_replace('\\', '/', (php_sapi_name() == 'cgi' || php_sapi_name() == 'isapi' || php_sapi_name() == 'cgi-fcgi') && ($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) ? $_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED'] : ($_SERVER['ORIG_SCRIPT_FILENAME'] ? $_SERVER['ORIG_SCRIPT_FILENAME'] : $_SERVER['SCRIPT_FILENAME'])))); define('PATH_site', dirname(PATH_thisScript) . '/'); if (@is_dir(PATH_site . 'typo3/sysext/cms/tslib/')) { define('PATH_tslib', PATH_site . 'typo3/sysext/cms/tslib/'); } elseif (@is_dir(PATH_site . 'tslib/')) { define('PATH_tslib', PATH_site . 'tslib/'); } else { // define path to tslib/ here: $configured_tslib_path = ''; // example: // $configured_tslib_path = '/var/www/mysite/typo3/sysext/cms/tslib/'; define('PATH_tslib', $configured_tslib_path); } if (PATH_tslib == '') { die('Cannot find tslib/. Please set path by defining $configured_tslib_path in ' . basename(PATH_thisScript) . '.'); } chdir(PATH_site); /* Check Page TSConfig for a preview page that we should use */ $pageTSConf = BackendUtility::getPagesTSconfig($event['pid']); if ($pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin']) { $pageIDForPlugin = $pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin']; } else { $pageIDForPlugin = $event['pid']; } $page = BackendUtility::getRecord('pages', intval($pageIDForPlugin), "doktype"); if ($page['doktype'] != 254) { /** @var \TYPO3\CMS\Cal\Controller\Api $calAPI */ $calAPI = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\Api'); $calAPI =& $calAPI->tx_cal_api_without($pageIDForPlugin); $eventObject = $calAPI->modelObj->findEvent($event['uid'], 'tx_cal_phpicalendar', $calAPI->conf['pidList'], false, false, false, true); $calAPI->conf['view'] = 'event'; $reminderService =& Functions::getReminderService(); $reminderService->remind($eventObject, $eventMonitor); return true; } $message = 'Cal was not able to send a reminder notice. You have to point to a page containing the cal Plugin. Configure in pageTSConf of page ' . $event['pid'] . ': options.tx_cal_controller.pageIDForPlugin'; throw new FailedExecutionException($message, 1250596541); }
/** * Add options to FlexForm Selection * * @param array $params * @param string $type "type", "validation", "feUserProperty" * @return void */ protected function addOptions(&$params, $type) { $typoScriptConfiguration = BackendUtility::getPagesTSconfig($params['row']['pid']); $extensionConfiguration = $typoScriptConfiguration[$this->extension . '.']['flexForm.']; if (!empty($extensionConfiguration[$type . '.']['addFieldOptions.'])) { $options = $extensionConfiguration[$type . '.']['addFieldOptions.']; foreach ((array) $options as $value => $label) { $params['items'][] = array($label, $value); } } }
/** * Add options to FlexForm Selection - Options can be defined in TSConfig * * @param array $params * @return void */ public function addOptions(&$params) { $this->initialize(); $tSconfig = BackendUtility::getPagesTSconfig($this->getPid()); $this->addCaptchaOption($params); if (!empty($tSconfig['tx_femanager.']['flexForm.'][$params['config']['itemsProcFuncTab'] . '.']['addFieldOptions.'])) { $options = $tSconfig['tx_femanager.']['flexForm.'][$params['config']['itemsProcFuncTab'] . '.']['addFieldOptions.']; foreach ((array) $options as $value => $label) { $params['items'][] = array(GeneralUtility::isFirstPartOfStr($label, 'LLL:') ? $this->languageService->sL($label) : $label, $value); } } }
protected function getMergedConfiguration($pid, $node, $cType) { // Get configuration ctype specific configuration $cTypeConfig = $GLOBALS["BE_USER"]->getTSConfig('themes.content.' . $node . '.' . $cType, \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid)); $this->ctypeProperties = $cTypeConfig['properties']; // Get default configuration $defaultConfig = $GLOBALS["BE_USER"]->getTSConfig('themes.content.' . $node . '.default', \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid)); $this->defaultProperties = $defaultConfig['properties']; // Merge configurations $config = ArrayUtility::arrayMergeRecursiveOverrule($cTypeConfig, $defaultConfig); return $config; }
/** * Preprocessing of fields * * @param string $table table name * @param string $field field name * @param array $row record row * @return void */ public function getSingleField_preProcess($table, $field, array &$row) { // Predefine the archive date if ($table === 'tx_news_domain_model_news' && empty($row['archive']) && is_numeric($row['pid'])) { $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($row['pid']); if (is_array($pagesTsConfig['tx_news.']['predefine.']) && is_array($pagesTsConfig['tx_news.']['predefine.']) && isset($pagesTsConfig['tx_news.']['predefine.']['archive'])) { $calculatedTime = strtotime($pagesTsConfig['tx_news.']['predefine.']['archive']); if ($calculatedTime !== FALSE) { $row['archive'] = $calculatedTime; } } } }
/** * Create Array for Form Selection * Show all forms only from a pid and it's subpages: * tx_powermail.flexForm.formSelection = 123 * Show all forms only from this pid and it's subpages: * tx_powermail.flexForm.formSelection = current * If no TSConfig set, all forms will be shown * * @param array $params * @param object $pObj Parent Object * @return void */ public function getForms(&$params, $pObj) { $typoScriptConfiguration = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig(Div::getPidFromBackendPage()); $language = $params['row']['sys_language_uid']; $startPid = 0; if (!empty($typoScriptConfiguration['tx_powermail.']['flexForm.']['formSelection'])) { $startPid = $typoScriptConfiguration['tx_powermail.']['flexForm.']['formSelection']; } $params['items'] = array(); foreach ($this->getAllForms($startPid, $language) as $form) { $params['items'][] = array($form['title'], $form['uid']); } }
/** * Returns a PageTsConfig instance for a given page. * * @param int $pageUid * @return \R3H6\Error404page\Configuration\PageTsConfig */ public function getPageTsConfig($pageUid) { $pageUid = (int) $pageUid; if (!isset($this->pageTsConfig[$pageUid])) { $pageTsConfig = $this->typoScriptService->convertTypoScriptArrayToPlainArray(BackendUtility::getPagesTSconfig($pageUid)); $configuration = array(); if (isset($pageTsConfig[self::TSCONFIG_KEY])) { $configuration = (array) $pageTsConfig[self::TSCONFIG_KEY]; } $this->pageTsConfig[$pageUid] = GeneralUtility::makeInstance('R3H6\\Error404page\\Configuration\\PageTsConfig', $configuration, $pageUid); } return $this->pageTsConfig[$pageUid]; }
/** * Add options to FlexForm Selection - Options can be defined in TSConfig * * @param $params * @param $pObj * @return void */ public function addOptions(&$params, &$pObj) { $tSconfig = BackendUtility::getPagesTSconfig($this->getPid()); // add Captcha field if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('sr_freecap')) { $params['items'][] = array($GLOBALS['LANG']->sL('LLL:EXT:femanager/Resources/Private/Language/locallang_db.xlf:tx_femanager_domain_model_user.captcha'), 'captcha'); } // add fields from TSconfig if (!empty($tSconfig['tx_femanager.']['flexForm.'][$params['config']['itemsProcFuncTab'] . '.']['addFieldOptions.'])) { $options = $tSconfig['tx_femanager.']['flexForm.'][$params['config']['itemsProcFuncTab'] . '.']['addFieldOptions.']; foreach ((array) $options as $value => $label) { $params['items'][] = array(GeneralUtility::isFirstPartOfStr($label, 'LLL:') ? $GLOBALS['LANG']->sL($label) : $label, $value); } } }
/** * Adds items to a colpos list * * @param array $items : The array of items before the action * @param string $CType : The content type of the item holding the colPosList * * @return array $items: The ready made array of items */ protected function addColPosListLayoutItems($pid, array $items, $CType = '') { #\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(array("id"=>$pid)); if (count($items) == 0) { $items = $GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items']; array_unshift($items, array('', '', NULL, NULL)); $count = 0; foreach ($items as &$item) { $item[0] = $GLOBALS['LANG']->sL($item[0]); } } $pageTS = BackendUtility::getPagesTSconfig($pid); #\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(array("pageTS"=>$pageTS)); $colPos = $pageTS['plugin.']['tx_universalcontentlists.']['articlelistColPos']; $items[] = array($GLOBALS['LANG']->sL('LLL:EXT:universal_content_lists/Resources/Private/Language/Backend.xlf:articles'), $colPos, NULL, NULL); return $items; }
protected function initialize($extKey) { $setup = $this->getTypoScriptSetup(); $setup = $setup['plugin.']['tx_' . $extKey . '.']; $tsConfig = BackendUtility::getPagesTSconfig($this->getCurrentPageId()); $tsConfig = $tsConfig['plugin.']['tx_' . $extKey . '.']; if ($setup['settings.']['apiKey'] && $setup['settings.']['apiKey'][0] != '{') { $apiKey = $setup['settings.']['apiKey']; } else { if ($tsConfig['settings.']['apiKey'] && $tsConfig['settings.']['apiKey'][0] != '{') { $apiKey = $tsConfig['settings.']['apiKey']; } else { $globals = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extKey]); $apiKey = $globals['apiKey']; } } $this->api = new MailChimpApi($apiKey); }
/** * @param array $queryParts * @param AbstractDatabaseRecordList $recordList * @param string $table */ public function makeQueryArray_post(array &$queryParts, AbstractDatabaseRecordList $recordList, $table) { if ($table === 'tt_content' && (int) $recordList->searchLevels === 0 && $recordList->id > 0) { $pageRecord = BackendUtility::getRecord('pages', $recordList->id, 'uid', ' AND doktype="254" AND module="news"'); if (is_array($pageRecord)) { $tsConfig = BackendUtility::getPagesTSconfig($recordList->id); if (isset($tsConfig['tx_news.']) && is_array($tsConfig['tx_news.']) && $tsConfig['tx_news.']['showContentElementsInNewsSysFolder'] == 1) { return; } $queryParts['WHERE'] = '1=2'; $message = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->sL('LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:hiddenContentElements.description'), '', FlashMessage::INFO); /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */ $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($message); } } }
/** * Returns RichTextElement as class name if RTE widget should be rendered. * * @return string|void New class name or void if this resolver does not change current class name. */ public function resolve() { $table = $this->globalOptions['table']; $fieldName = $this->globalOptions['fieldName']; $row = $this->globalOptions['databaseRow']; $parameterArray = $this->globalOptions['parameterArray']; $backendUser = $this->getBackendUserAuthentication(); if ( // Whole thing is not read only empty($this->globalOptions['renderReadonly']) // This field is not read only && !$parameterArray['fieldConf']['config']['readOnly'] // If RTE is generally enabled by user settings and RTE object registry can return something valid && $backendUser->isRTE() ) { $specialConfiguration = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']); // $parameters is a key=>value array from "defaultExtras" pipe separated rte_transform string $parameters = BackendUtility::getSpecConfParametersFromArray($specialConfiguration['rte_transform']['parameters']); if ( // If "richtext" is within defaultExtras isset($specialConfiguration['richtext']) // rte_transform[flag=foo] means RTE should only be rendered if the value of db row field "foo" can be interpreted as TRUE && (!$parameters['flag'] || !$row[$parameters['flag']]) ) { // Operates by reference on $row! 'pid' is changed ... BackendUtility::fixVersioningPid($table, $row); list($recordPid, $tsConfigPid) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']); // If the pid-value is not negative (that is, a pid could NOT be fetched) if ($tsConfigPid >= 0) { // Fetch page ts config and do some magic with it to find out if RTE is disabled on TS level. $rteSetup = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($recordPid)); $rteTcaTypeValue = BackendUtility::getTCAtypeValue($table, $row); $rteSetupConfiguration = BackendUtility::RTEsetup($rteSetup['properties'], $table, $fieldName, $rteTcaTypeValue); if (!$rteSetupConfiguration['disabled']) { // Finally, we're sure the editor should really be rendered ... return RichtextElement::class; } } } } return NULL; }
/** * Renders the ckeditor element * * @return array * @throws \InvalidArgumentException */ public function render() : array { $resultArray = $this->initializeResultArray(); $row = $this->data['databaseRow']; BackendUtility::fixVersioningPid($this->data['tableName'], $row); $this->pidOfVersionedMotherRecord = (int) $row['pid']; $resourcesPath = PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::extPath('rte_ckeditor', 'Resources/Public/')); $table = $this->data['tableName']; $row = $this->data['databaseRow']; $parameterArray = $this->data['parameterArray']; $defaultExtras = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']); BackendUtility::fixVersioningPid($table, $row); $fieldId = $this->sanitizeFieldId($parameterArray['itemFormElName']); $resultArray['html'] = $this->renderWizards([$this->getHtml($fieldId)], $parameterArray['fieldConf']['config']['wizards'], $table, $row, $this->data['fieldName'], $parameterArray, $parameterArray['itemFormElName'], $defaultExtras, true); $vanillaRteTsConfig = $this->getBackendUserAuthentication()->getTSConfig('RTE', BackendUtility::getPagesTSconfig($this->data['effectivePid'])); $this->rteConfiguration = BackendUtility::RTEsetup($vanillaRteTsConfig['properties'], $table, $this->data['fieldName'], $this->data['recordTypeValue']); $resultArray['requireJsModules'] = []; $resultArray['requireJsModules'][] = ['ckeditor' => $this->getCkEditorRequireJsModuleCode($resourcesPath, $fieldId)]; return $resultArray; }
/** * Preprocessing of fields * * @param string $table table name * @param string $field field name * @param array $row record row * @return void */ public function getSingleField_preProcess($table, $field, array &$row) { if ($table !== 'tx_news_domain_model_news') { return; } // Set current time for new records if (substr($row['uid'], 0, 3) === 'NEW') { $row['datetime'] = $GLOBALS['EXEC_TIME']; } // Predefine archive date if (empty($row['archive']) && is_numeric($row['pid'])) { $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($row['pid']); if (is_array($pagesTsConfig['tx_news.']['predefine.']) && is_array($pagesTsConfig['tx_news.']['predefine.']) && isset($pagesTsConfig['tx_news.']['predefine.']['archive'])) { $calculatedTime = strtotime($pagesTsConfig['tx_news.']['predefine.']['archive']); if ($calculatedTime !== FALSE) { $row['archive'] = $calculatedTime; } } } }
/** * Gets backend layout items to be shown in the forms engine. * This method is called as "itemsProcFunc" with the accordant context * for pages.backend_layout and pages.backend_layout_next_level. * * @param array $parameters */ public function addBackendLayoutItems(array $parameters) { $pageId = $this->determinePageId($parameters['table'], $parameters['row']); $pageTsConfig = (array) BackendUtility::getPagesTSconfig($pageId); $identifiersToBeExcluded = $this->getIdentifiersToBeExcluded($pageTsConfig); $dataProviderContext = $this->createDataProviderContext()->setPageId($pageId)->setData($parameters['row'])->setTableName($parameters['table'])->setFieldName($parameters['field'])->setPageTsConfig($pageTsConfig); $backendLayoutCollections = $this->getDataProviderCollection()->getBackendLayoutCollections($dataProviderContext); foreach ($backendLayoutCollections as $backendLayoutCollection) { $combinedIdentifierPrefix = ''; if ($backendLayoutCollection->getIdentifier() !== 'default') { $combinedIdentifierPrefix = $backendLayoutCollection->getIdentifier() . '__'; } foreach ($backendLayoutCollection->getAll() as $backendLayout) { $combinedIdentifier = $combinedIdentifierPrefix . $backendLayout->getIdentifier(); if (in_array($combinedIdentifier, $identifiersToBeExcluded, true)) { continue; } $parameters['items'][] = array($this->getLanguageService()->sL($backendLayout->getTitle()), $combinedIdentifier, $backendLayout->getIconPath()); } } }
public function processDatamap_afterDatabaseOperations($status, $table, $recordUid, array $fields, \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject) { // Preview link if ($table === 'tx_hwtaddress_domain_model_address') { // direct preview if (!is_numeric($recordUid)) { $recordUid = $parentObject->substNEWwithIDs[$recordUid]; } if (isset($GLOBALS['_POST']['_savedokview_x'])) { // If "savedokview" has been pressed $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']); $pagesTsConfigSinglePid = $pagesTsConfig['tx_hwtaddress.']['singlePidAddress']; if ($pagesTsConfigSinglePid) { $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $recordUid); $parameters = array('no_cache' => 1, 'tx_hwtaddress_address[address]' => $recordUid); $GLOBALS['_POST']['popViewId_addParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $parameters, '', FALSE, TRUE); $GLOBALS['_POST']['popViewId'] = $pagesTsConfigSinglePid; } } } }
/** * Itemsproc function to extend the selection of templateLayouts in the plugin * * @param array &$config configuration array * @return void */ public function user_templateLayout(array &$config) { // Check if the layouts are extended by ext_tables if (isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['tx_t3eventscourse']['templateLayouts']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXT']['tx_t3eventscourse']['templateLayouts'])) { // Add every item foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['t3events_course']['templateLayouts'] as $layouts) { $additionalLayout = [$GLOBALS['LANG']->sL($layouts[0], TRUE), $layouts[1]]; array_push($config['items'], $additionalLayout); } } // Add tsconfig values if (is_numeric($config['row']['pid'])) { $pagesTsConfig = BackendUtility::getPagesTSconfig($config['row']['pid']); if (isset($pagesTsConfig['tx_t3eventscourse.']['templateLayouts.']) && is_array($pagesTsConfig['tx_t3eventscourse.']['templateLayouts.'])) { // Add every item foreach ($pagesTsConfig['tx_t3eventscourse.']['templateLayouts.'] as $key => $label) { $additionalLayout = [$GLOBALS['LANG']->sL($label, TRUE), $key]; array_push($config['items'], $additionalLayout); } } } }
/** * This will render a <textarea> OR RTE area form field, * possibly with various control/validation features * * @return array As defined in initializeResultArray() of AbstractNode */ public function render() { $table = $this->globalOptions['table']; $fieldName = $this->globalOptions['fieldName']; $row = $this->globalOptions['databaseRow']; $parameterArray = $this->globalOptions['parameterArray']; $resultArray = $this->initializeResultArray(); $backendUser = $this->getBackendUserAuthentication(); $validationConfig = array(); // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. Traditionally, this is where RTE configuration has been found. $specialConfiguration = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']); // Setting up the altItem form field, which is a hidden field containing the value $altItem = '<input type="hidden" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />'; BackendUtility::fixVersioningPid($table, $row); list($recordPid, $tsConfigPid) = BackendUtility::getTSCpidCached($table, $row['uid'], $row['pid']); // If the pid-value is not negative (that is, a pid could NOT be fetched) $rteSetup = $backendUser->getTSConfig('RTE', BackendUtility::getPagesTSconfig($recordPid)); $rteTcaTypeValue = BackendUtility::getTCAtypeValue($table, $row); $rteSetupConfiguration = BackendUtility::RTEsetup($rteSetup['properties'], $table, $fieldName, $rteTcaTypeValue); // Get RTE object, draw form and set flag: $rteObject = BackendUtility::RTEgetObj(); $dummyFormEngine = new FormEngine(); $rteResult = $rteObject->drawRTE($dummyFormEngine, $table, $fieldName, $row, $parameterArray, $specialConfiguration, $rteSetupConfiguration, $rteTcaTypeValue, '', $tsConfigPid, $this->globalOptions, $this->initializeResultArray(), $this->getValidationDataAsDataAttribute($validationConfig)); // This is a compat layer for "other" RTE's: If the result is not an array, it is the html string, // otherwise it is a structure similar to our casual return array // @todo: This interface needs a full re-definition, RTE should probably be its own type in the // @todo: end, and other RTE implementations could then just override this. if (is_array($rteResult)) { $html = $rteResult['html']; $rteResult['html'] = ''; $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $rteResult); } else { $html = $rteResult; } // Wizard $html = $this->renderWizards(array($html, $altItem), $parameterArray['fieldConf']['config']['wizards'], $table, $row, $fieldName, $parameterArray, $parameterArray['itemFormElName'], $specialConfiguration, TRUE); $resultArray['html'] = $html; return $resultArray; }
/** * The "Columns" view now brings the "Make new translation of this * page" feature. We need to switch languageMode on to enforce those * UI elements but overrule the "languageCols" to empty to avoid * additional language columns. */ public function __construct() { parent::__construct(); /** @var \TYPO3\CMS\Backend\Controller\PageLayoutController $pageLayoutController */ $pageLayoutController = $GLOBALS['SOBE']; $language = (int) $pageLayoutController->current_sys_language; if ($this->validModuleConfig() && $language <= 0) { $this->tt_contentConfig['languageMode'] = 1; $this->tt_contentConfig['languageCols'] = array(); } $skipTranslations = $GLOBALS['BE_USER']->getTSConfig('mod.web_layout.skipTranslations', \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig((int) $pageLayoutController->id))['properties']; foreach ($skipTranslations as $skipTranslation) { foreach ($skipTranslation as $columnName => $options) { $skipTranslation[$columnName] = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $options); } $this->skipTranslations[] = $skipTranslation; } /** @var $pageRenderer \TYPO3\CMS\Core\Page\PageRenderer */ $pageRenderer = $this->getPageLayoutController()->doc->getPageRenderer(); $pageRenderer->addCssInlineBlock('nxcondensedbelayout-languages', '.t3-page-ce .t3-row-header .ce-icons, .t3-page-ce .t3-row-header .ce-icons-left {visibility: visible !important;}'); $pageRenderer->addJsInlineCode(__CLASS__, self::POSITION_RUNNER); }
public function processDatamap_preProcessFieldArray(&$fieldArray, $table, $uid, &$pObj) { if ($table == 'tx_linkdirectory_domain_model_link' && isset($GLOBALS['_POST']['_savedokview_x']) && !$GLOBALS['BE_USER']->workspace) { // The GETparam which is used in the single view of the plugin //$getParam = 'tx_extExample_pi1[showUid]'; // get page TSconfig $pageTS = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']); // get pid of single view $previewPid = $pageTS['tx_linkdirectory.']['previewPid']; if ($previewPid) { // set page id to be shown $GLOBALS['_POST']['popViewId'] = $previewPid; // don't cache the page $GLOBALS['_POST']['popViewId_addParams'] = '&no_cache=1'; // set language parameter if ($fieldArray['sys_language_uid'] > 0) { $GLOBALS['_POST']['popViewId_addParams'] .= '&L=' . $fieldArray['sys_language_uid']; } // set plugin GETparams //$GLOBALS['_POST']['popViewId_addParams'] .= '&' . $getParam . '=' . $uid; } } }