/** * Constructor */ public function __construct() { $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); GeneralUtility::deprecationLog('PageTreeNavigationController is deprecated in favor of new pagetrees'); $GLOBALS['SOBE'] = $this; $this->init(); }
/** * constructor just init's the temp-file-name * * @deprecated since TYPO3 CMS 7, will be removed with TYPO3 CMS 8 */ public function __construct() { GeneralUtility::deprecationLog(self::class . ' is deprecated since TYPO3 CMS 7, will be removed with TYPO3 CMS 8'); // The file name is prefixed with "z" since the concatenator orders files per name $this->cssTcaFile = PATH_site . SpriteManager::$tempPath . 'zextensions.css'; $this->styleSheetData = '/* Auto-Generated via ' . get_class($this) . ' */' . LF; }
/** * Render the supplied DateTime object as a formatted date. * * @param mixed $date \DateTime object or a string that is accepted by DateTime constructor * @param string $format Format String which is taken to format the Date/Time * @param bool $currentDate if true, the current date is used * @param bool $strftime if true, the strftime is used instead of date() * @return string Formatted date * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception */ public function render($date = null, $format = '%Y-%m-%d', $currentDate = false, $strftime = true) { GeneralUtility::deprecationLog('The ViewHelper "format.date" of EXT:news is deprecated! Use the one of the core!'); if ($currentDate) { if ($strftime) { return strftime($format, $GLOBALS['EXEC_TIME']); } else { return date($format, $GLOBALS['EXEC_TIME']); } } if ($date === null) { $date = $this->renderChildren(); if ($date === null) { return ''; } } if (!$date instanceof \DateTime) { try { $date = new \DateTime($date); } catch (\Exception $exception) { throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('"' . $date . '" could not be parsed by DateTime constructor.', 1241722579); } } if ($strftime) { $formattedDate = strftime($format, $date->format('U')); } else { $formattedDate = date($format, $date->format('U')); } return $formattedDate; }
/** * Renders a record list as known from the TYPO3 list module * Note: This feature is experimental! * * @param string $tableName name of the database table * @param array $fieldList list of fields to be displayed. If empty, only the title column (configured in $TCA[$tableName]['ctrl']['title']) is shown * @param int $storagePid by default, records are fetched from the storage PID configured in persistence.storagePid. With this argument, the storage PID can be overwritten * @param int $levels corresponds to the level selector of the TYPO3 list module. By default only records from the current storagePid are fetched * @param string $filter corresponds to the "Search String" textbox of the TYPO3 list module. If not empty, only records matching the string will be fetched * @param int $recordsPerPage amount of records to be displayed at once. Defaults to $TCA[$tableName]['interface']['maxSingleDBListItems'] or (if that's not set) to 100 * @param string $sortField table field to sort the results by * @param bool $sortDescending if TRUE records will be sorted in descending order * @param bool $readOnly if TRUE, the edit icons won't be shown. Otherwise edit icons will be shown, if the current BE user has edit rights for the specified table! * @param bool $enableClickMenu enables context menu * @param string $clickTitleMode one of "edit", "show" (only pages, tt_content), "info * @param bool $alternateBackgroundColors Deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 * @return string the rendered record list * @see \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList */ public function render($tableName, array $fieldList = array(), $storagePid = NULL, $levels = 0, $filter = '', $recordsPerPage = 0, $sortField = '', $sortDescending = FALSE, $readOnly = FALSE, $enableClickMenu = TRUE, $clickTitleMode = NULL, $alternateBackgroundColors = FALSE) { if ($alternateBackgroundColors) { \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('The option alternateBackgroundColors has no effect anymore and can be removed without problems. The parameter will be removed in TYPO3 CMS 8.'); } $pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'), $GLOBALS['BE_USER']->getPagePermsClause(1)); /** @var $dblist \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList */ $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class); $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->pageRow = $pageinfo; if ($readOnly === FALSE) { $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo); } $dblist->showClipboard = FALSE; $dblist->disableSingleTableView = TRUE; $dblist->clickTitleMode = $clickTitleMode; $dblist->clickMenuEnabled = $enableClickMenu; if ($storagePid === NULL) { $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); $storagePid = $frameworkConfiguration['persistence']['storagePid']; } $dblist->start($storagePid, $tableName, (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pointer'), $filter, $levels, $recordsPerPage); $dblist->allFields = TRUE; $dblist->dontShowClipControlPanels = TRUE; $dblist->displayFields = FALSE; $dblist->setFields = array($tableName => $fieldList); $dblist->noControlPanels = TRUE; $dblist->sortField = $sortField; $dblist->sortRev = $sortDescending; $dblist->script = $_SERVER['REQUEST_URI']; $dblist->generateList(); return $dblist->HTMLcode; }
/** * Constructor */ public function __construct() { GeneralUtility::deprecationLog('PageTreeNavigationController is deprecated in favor of new pagetrees'); $GLOBALS['SOBE'] = $this; $GLOBALS['BACK_PATH'] = ''; $this->init(); }
/** * @param mixed $value */ public function __construct($value = null) { if (isset(static::$legacyValueMap[$value])) { GeneralUtility::deprecationLog('Using ' . $value . ' for resolving conflicts in file names is deprecated. Make use of the enumeration "\\TYPO3\\CMS\\Core\\Resource\\DuplicationBehavior" instead.'); $value = static::$legacyValueMap[$value]; } parent::__construct($value); }
/** * @param array $arguments * @param \Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * @return mixed */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { GeneralUtility::deprecationLog(sprintf('Deprecated TypoLinkViewHelper from VHS was used. Please use %s instead.', FluidTypolinkViewHelper::class)); if (null === $arguments['configuration']['additionalAttributes']) { $arguments['configuration']['additionalAttributes'] = []; } return FluidTypolinkViewHelper::renderStatic($arguments['configuration'], $renderChildrenClosure, $renderingContext); }
/** * Constructor of a Generic component in Vidi. * * @param array $configuration * @param array $legacyParameterConfiguration */ public function __construct($configuration = array(), $legacyParameterConfiguration = array()) { if (is_string($configuration)) { $configuration = $legacyParameterConfiguration; GeneralUtility::deprecationLog('ColumnRendererAbstract: first parameter must now be an array. Please edit me in ' . get_class($this)); } $this->configuration = $configuration; }
/** * Render content with htmlspecialchars * * @return string Formatted date * @deprecated Use Tx_Fluid_ViewHelpers_Format_HtmlspecialcharsViewHelper instead */ public function render() { if (class_exists('Tx_Fluid_ViewHelpers_Format_HtmlspecialcharsViewHelper')) { $message = 'EXT:news: Since TYPO3 4.6.0, a native ViewHelper for htmlspecialchars() ' . 'is available, use f:format.htmlspecialchars instead of n:format.hsc'; \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog($message); } return htmlspecialchars($this->renderChildren()); }
/** * Constructs the Statement instance * * @param string|\TYPO3\CMS\Core\Database\PreparedStatement $statement The statement as sql string or TYPO3\CMS\Core\Database\PreparedStatement * @param array $boundVariables An array of variables to bind to the statement, only to be used with preparedStatement */ public function __construct($statement, array $boundVariables = array()) { // @deprecated since 6.2, using $boundVariables without preparedStatement will be removed in two versions if (!empty($boundVariables) && !$statement instanceof \TYPO3\CMS\Core\Database\PreparedStatement) { \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('Using boundVariables' . ' in Extbase\'s custom statement without using preparedStatement is' . ' deprecated since TYPO3 6.2 and will be removed in two versions.'); } $this->statement = $statement; $this->boundVariables = $boundVariables; }
/** * Render context sensitive help (CSH) for the given table * * @param string $table Table name ('_MOD_'+module name). If not set, the current module name will be used * @param string $field Field name (CSH locallang main key) * @param bool $iconOnly Deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 * @param string $styleAttributes Deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 * @return string the rendered CSH icon */ public function render($table = NULL, $field = '', $iconOnly = FALSE, $styleAttributes = '') { if ($iconOnly) { \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('The option iconOnly has no effect anymore and can be removed without problems. The parameter will be removed in TYPO3 CMS 8.'); } if ($styleAttributes) { \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('The option styleAttributes has no effect anymore and can be removed without problems. The parameter will be removed in TYPO3 CMS 8.'); } return static::renderStatic(array('table' => $table, 'field' => $field), $this->buildRenderChildrenClosure(), $this->renderingContext); }
/** * Run migration dynamically a second time on *every* request. * This can not be cached and is slow. * * @return void */ public function processData() { /** @var \TYPO3\CMS\Core\Migrations\TcaMigration $tcaMigration */ $tcaMigration = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Migrations\TcaMigration::class); $GLOBALS['TCA'] = $tcaMigration->migrate($GLOBALS['TCA']); $messages = $tcaMigration->getMessages(); if (!empty($messages)) { $context = 'ext:compatibility6 did an automatic migration of TCA during boostrap. This costs performance on every' . ' call. It also means some old extensions register TCA in ext_tables.php and not in Configuration/TCA.' . ' Please adapt TCA accordingly until this message is not thrown anymore and unload extension compatibility6' . ' as soon as possible'; array_unshift($messages, $context); GeneralUtility::deprecationLog(implode(LF, $messages)); } }
/** * Fetch available system languages and resolve iso code if necessary. * * @param array $result * @return array * @throws \UnexpectedValueException */ public function addData(array $result) { $database = $this->getDatabase(); $languageService = $this->getLanguageService(); $pageTs = $result['pageTsConfig']; $defaultLanguageLabel = $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'); if (isset($pageTs['mod.']['SHARED.']['defaultLanguageLabel'])) { $defaultLanguageLabel = $pageTs['mod.']['SHARED.']['defaultLanguageLabel'] . ' (' . $languageService->sL($defaultLanguageLabel) . ')'; } $defaultLanguageFlag = 'empty-empty'; if (isset($pageTs['mod.']['SHARED.']['defaultLanguageFlag'])) { $defaultLanguageFlag = 'flags-' . $pageTs['mod.']['SHARED.']['defaultLanguageFlag']; } $languageRows = [-1 => ['uid' => -1, 'title' => $languageService->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:multipleLanguages'), 'iso' => 'DEF', 'flagIconIdentifier' => 'flags-multiple'], 0 => ['uid' => 0, 'title' => $defaultLanguageLabel, 'iso' => 'DEF', 'flagIconIdentifier' => $defaultLanguageFlag]]; $dbRows = $database->exec_SELECTgetRows('uid,title,language_isocode,static_lang_isocode,flag', 'sys_language', 'pid=0 AND hidden=0'); if ($dbRows === null) { throw new \UnexpectedValueException('Database query error ' . $database->sql_error(), 1438170741); } $isStaticInfoTablesLoaded = ExtensionManagementUtility::isLoaded('static_info_tables'); foreach ($dbRows as $dbRow) { $uid = $dbRow['uid']; $languageRows[$uid] = ['uid' => $uid, 'title' => $dbRow['title'], 'flagIconIdentifier' => 'flags-' . $dbRow['flag']]; if (!empty($dbRow['language_isocode'])) { $languageRows[$uid]['iso'] = $dbRow['language_isocode']; } elseif ($isStaticInfoTablesLoaded && !empty($dbRow['static_lang_isocode'])) { GeneralUtility::deprecationLog('Usage of the field "static_lang_isocode" is discouraged, and will stop working with CMS 8. Use the built-in' . ' language field "language_isocode" in your sys_language records.'); $lg_iso_2 = BackendUtility::getRecord('static_languages', $dbRow['static_lang_isocode'], 'lg_iso_2'); if ($lg_iso_2['lg_iso_2']) { $languageRows[$uid]['iso'] = $lg_iso_2['lg_iso_2']; } } else { // No iso code could be found. This is currently possible in the system but discouraged. // So, code within FormEngine has to be suited to work with an empty iso code. However, // it may impact certain multi language scenarios, so we add a flash message hinting for // incomplete configuration here. // It might be possible to convert this to a non-catchable exception later if // it iso code is enforced on a different layer of the system (tca required + migration wizard). // @todo: This could be relaxed again if flex form language handling is extracted, // @todo: since the rest of the FormEngine code does not rely on iso code? $message = sprintf($languageService->sL('LLL:EXT:lang/locallang_core.xlf:error.missingLanguageIsocode'), $dbRow['title'], $uid); /** @var FlashMessage $flashMessage */ $flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $message, '', FlashMessage::ERROR); /** @var $flashMessageService FlashMessageService */ $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class); $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($flashMessage); $languageRows[$uid]['iso'] = ''; } } $result['systemLanguageRows'] = $languageRows; return $result; }
/** * Converts all HTML entities to their applicable characters as needed * using PHPs html_entity_decode() function. * * @param string $value string to format * @param bool $keepQuotes if TRUE, single and double quotes won't be replaced * @return string the altered string * @see http://www.php.net/html_entity_decode */ public function render($value = null, $keepQuotes = false) { if (class_exists('TYPO3\\CMS\\Fluid\\ViewHelpers\\Format\\HtmlentitiesDecodeViewHelper')) { $message = 'EXT:news: Since TYPO3 4.6.0, a native ViewHelper for html_entity_decode() ' . 'is available, use f:format.htmlentitiesDecode instead of n:format.htmlEntityDecode'; \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog($message); } if ($value === null) { $value = $this->renderChildren(); } if (!is_string($value)) { return $value; } $flags = $keepQuotes ? ENT_NOQUOTES : ENT_COMPAT; return html_entity_decode($value, $flags); }
/** * Hook to add custom content * * @return array with additional content sections * @deprecated Since 4.7; will be removed together with the call in indexAction and the fluid partial in 6.1 */ protected function getCustomContent() { $sections = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['about/index.php']['addSection'])) { \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('Hook about/index.php addSection is deprecated and will be removed in TYPO3 6.1, use fluid overrides instead.'); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['about/index.php']['addSection'] as $classRef) { /** @var $hookObject \TYPO3\CMS\About\CustomSectionsInterface */ $hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); if (!$hookObject instanceof \TYPO3\CMS\About\CustomSectionsInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\About\\CustomSectionsInterface', 1298121573); } $hookObject->addSection($sections); } } return $sections; }
/** * Other extensions may rely on the fact that $GLOBALS['SOBE'] exists and holds * the DocumentTemplate instance. We should really get rid of this, but for now, let's be backwards compatible. * Relying on $GLOBALS['SOBE'] is @deprecated since 6.0 and will be removed in 6.2 Instead ->getDocInstance() should be used. * * If $GLOBALS['SOBE']->doc holds an instance of \TYPO3\CMS\Backend\Template\DocumentTemplate we reuse it, * if not we create a new one. * * Relying on $GLOBALS['SOBE'] is * @deprecated since 6.0 and will be removed in 6.2 ->getDocInstance() should be used instead. * * @return \TYPO3\CMS\Backend\Template\DocumentTemplate */ protected function createDocInstance() { if (isset($GLOBALS['SOBE']) && is_object($GLOBALS['SOBE']) && isset($GLOBALS['SOBE']->doc) && $GLOBALS['SOBE']->doc instanceof \TYPO3\CMS\Backend\Template\DocumentTemplate) { GeneralUtility::deprecationLog('Usage of $GLOBALS[\'SOBE\'] is deprecated since 6.0 and will be removed in 6.2 ->getDocInstance() should be used instead'); $doc = $GLOBALS['SOBE']->doc; } else { $doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); if (!isset($GLOBALS['SOBE'])) { $GLOBALS['SOBE'] = new \stdClass(); } if (!isset($GLOBALS['SOBE']->doc)) { $GLOBALS['SOBE']->doc = $doc; } } return $doc; }
/** * Returns parsed data from a given file and language key. * * @param string $fileReference Input is a file-reference (see \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName). That file is expected to be a supported locallang file format * @param string $languageKey Language key * @param string $charset Character set (option); if not set, determined by the language key * @param int $errorMode Error mode (when file could not be found): 0 - syslog entry, 1 - do nothing, 2 - throw an exception$ * @param bool $isLocalizationOverride TRUE if $fileReference is a localization override * @return array|bool */ public function getParsedData($fileReference, $languageKey, $charset = '', $errorMode = 0, $isLocalizationOverride = false) { // @deprecated since TYPO3 v8, will be removed with TYPO3 v9 // this is a fallback to convert references to old 'lang' locallang files to the new location if (strpos($fileReference, 'EXT:lang/locallang_') === 0) { $mapping = ['lang/locallang_alt_doc.xlf' => 'lang/Resources/Private/Language/locallang_alt_doc.xlf', 'lang/locallang_alt_intro.xlf' => 'lang/Resources/Private/Language/locallang_alt_intro.xlf', 'lang/locallang_browse_links.xlf' => 'lang/Resources/Private/Language/locallang_browse_links.xlf', 'lang/locallang_common.xlf' => 'lang/Resources/Private/Language/locallang_common.xlf', 'lang/locallang_core.xlf' => 'lang/Resources/Private/Language/locallang_core.xlf', 'lang/locallang_general.xlf' => 'lang/Resources/Private/Language/locallang_general.xlf', 'lang/locallang_login.xlf' => 'lang/Resources/Private/Language/locallang_login.xlf', 'lang/locallang_misc.xlf' => 'lang/Resources/Private/Language/locallang_misc.xlf', 'lang/locallang_mod_admintools.xlf' => 'lang/Resources/Private/Language/locallang_mod_admintools.xlf', 'lang/locallang_mod_file_list.xlf' => 'lang/Resources/Private/Language/locallang_mod_file_list.xlf', 'lang/locallang_mod_file.xlf' => 'lang/Resources/Private/Language/locallang_mod_file.xlf', 'lang/locallang_mod_help_about.xlf' => 'lang/Resources/Private/Language/locallang_mod_help_about.xlf', 'lang/locallang_mod_help_cshmanual.xlf' => 'lang/Resources/Private/Language/locallang_mod_help_cshmanual.xlf', 'lang/locallang_mod_help.xlf' => 'lang/Resources/Private/Language/locallang_mod_help.xlf', 'lang/locallang_mod_system.xlf' => 'lang/Resources/Private/Language/locallang_mod_system.xlf', 'lang/locallang_mod_usertools.xlf' => 'lang/Resources/Private/Language/locallang_mod_usertools.xlf', 'lang/locallang_mod_user_ws.xlf' => 'lang/Resources/Private/Language/locallang_mod_user_ws.xlf', 'lang/locallang_mod_web_func.xlf' => 'lang/Resources/Private/Language/locallang_mod_web_func.xlf', 'lang/locallang_mod_web_info.xlf' => 'lang/Resources/Private/Language/locallang_mod_web_info.xlf', 'lang/locallang_mod_web_list.xlf' => 'lang/Resources/Private/Language/locallang_mod_web_list.xlf', 'lang/locallang_mod_web.xlf' => 'lang/Resources/Private/Language/locallang_mod_web.xlf', 'lang/locallang_show_rechis.xlf' => 'lang/Resources/Private/Language/locallang_show_rechis.xlf', 'lang/locallang_t3lib_fullsearch.xlf' => 'lang/Resources/Private/Language/locallang_t3lib_fullsearch.xlf', 'lang/locallang_tca.xlf' => 'lang/Resources/Private/Language/locallang_tca.xlf', 'lang/locallang_tcemain.xlf' => 'lang/Resources/Private/Language/locallang_tcemain.xlf', 'lang/locallang_tsfe.xlf' => 'lang/Resources/Private/Language/locallang_tsfe.xlf', 'lang/locallang_tsparser.xlf' => 'lang/Resources/Private/Language/locallang_tsparser.xlf', 'lang/locallang_view_help.xlf' => 'lang/Resources/Private/Language/locallang_view_help.xlf', 'lang/locallang_wizards.xlf' => 'lang/Resources/Private/Language/locallang_wizards.xlf']; $filePath = substr($fileReference, 4); GeneralUtility::deprecationLog('There is a reference to "' . $fileReference . '", which has been moved to "EXT:' . $mapping[$filePath] . '". This fallback will be removed with TYPO3 v9.'); $fileReference = 'EXT:' . $mapping[$filePath]; } $hash = md5($fileReference . $languageKey . $charset); $this->errorMode = $errorMode; // Check if the default language is processed before processing other language if (!$this->store->hasData($fileReference, 'default') && $languageKey !== 'default') { $this->getParsedData($fileReference, 'default', $charset, $this->errorMode); } // If the content is parsed (local cache), use it if ($this->store->hasData($fileReference, $languageKey)) { return $this->store->getData($fileReference); } // If the content is in cache (system cache), use it $data = $this->cacheInstance->get($hash); if ($data !== false) { $this->store->setData($fileReference, $languageKey, $data); return $this->store->getData($fileReference); } try { $this->store->setConfiguration($fileReference, $languageKey, $charset); /** @var $parser \TYPO3\CMS\Core\Localization\Parser\LocalizationParserInterface */ $parser = $this->store->getParserInstance($fileReference); // Get parsed data $LOCAL_LANG = $parser->getParsedData($this->store->getAbsoluteFileReference($fileReference), $languageKey, $charset); } catch (Exception\FileNotFoundException $exception) { // Source localization file not found, set empty data as there could be an override $this->store->setData($fileReference, $languageKey, []); $LOCAL_LANG = $this->store->getData($fileReference); } // Override localization if (!$isLocalizationOverride && isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'])) { $this->localizationOverride($fileReference, $languageKey, $charset, $errorMode, $LOCAL_LANG); } // Save parsed data in cache $this->store->setData($fileReference, $languageKey, $LOCAL_LANG[$languageKey]); // Cache processed data $this->cacheInstance->set($hash, $this->store->getDataByLanguage($fileReference, $languageKey)); return $this->store->getData($fileReference); }
/** * Returns parsed data from a given file and language key. * * @param string $fileReference Input is a file-reference (see \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName). That file is expected to be a supported locallang file format * @param string $languageKey Language key * @param string $charset Character set (option); if not set, determined by the language key * @param int $errorMode Error mode (when file could not be found): 0 - syslog entry, 1 - do nothing, 2 - throw an exception$ * @param bool $isLocalizationOverride TRUE if $fileReference is a localization override * @return array|bool */ public function getParsedData($fileReference, $languageKey, $charset = '', $errorMode = 0, $isLocalizationOverride = false) { // @deprecated since CMS 7, will be removed with CMS 8 // this is a fallback to convert references to old 'cms' locallang files to the new location if (strpos($fileReference, 'EXT:cms') === 0) { $mapping = ['cms/web_info/loallang.xlf' => 'frontend/Resources/Private/Language/locallang_webinfo.xlf', 'cms/locallang_ttc.xlf' => 'frontend/Resources/Private/Language/locallang_ttc.xlf', 'cms/locallang_tca.xlf' => 'frontend/Resources/Private/Language/locallang_tca.xlf', 'cms/layout/locallang_db_new_content_el.xlf' => 'backend/Resources/Private/Language/locallang_db_new_content_el.xlf', 'cms/layout/locallang.xlf' => 'backend/Resources/Private/Language/locallang_layout.xlf', 'cms/layout/locallang_mod.xlf' => 'backend/Resources/Private/Language/locallang_mod.xlf', 'cms/locallang_csh_webinfo.xlf' => 'frontend/Resources/Private/Language/locallang_csh_webinfo.xlf', 'cms/locallang_csh_weblayout.xlf' => 'frontend/Resources/Private/Language/locallang_csh_weblayout.xlf']; $filePath = substr($fileReference, 4); GeneralUtility::deprecationLog('There is a reference to "' . $fileReference . '", which has been moved to "EXT:' . $mapping[$filePath] . '". This fallback will be removed with CMS 8.'); $fileReference = 'EXT:' . $mapping[$filePath]; } $hash = md5($fileReference . $languageKey . $charset); $this->errorMode = $errorMode; // Check if the default language is processed before processing other language if (!$this->store->hasData($fileReference, 'default') && $languageKey !== 'default') { $this->getParsedData($fileReference, 'default', $charset, $this->errorMode); } // If the content is parsed (local cache), use it if ($this->store->hasData($fileReference, $languageKey)) { return $this->store->getData($fileReference); } // If the content is in cache (system cache), use it $data = $this->cacheInstance->get($hash); if ($data !== false) { $this->store->setData($fileReference, $languageKey, $data); return $this->store->getData($fileReference); } try { $this->store->setConfiguration($fileReference, $languageKey, $charset); /** @var $parser \TYPO3\CMS\Core\Localization\Parser\LocalizationParserInterface */ $parser = $this->store->getParserInstance($fileReference); // Get parsed data $LOCAL_LANG = $parser->getParsedData($this->store->getAbsoluteFileReference($fileReference), $languageKey, $charset); } catch (Exception\FileNotFoundException $exception) { // Source localization file not found, set empty data as there could be an override $this->store->setData($fileReference, $languageKey, array()); $LOCAL_LANG = $this->store->getData($fileReference); } // Override localization if (!$isLocalizationOverride && isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'])) { $this->localizationOverride($fileReference, $languageKey, $charset, $errorMode, $LOCAL_LANG); } // Save parsed data in cache $this->store->setData($fileReference, $languageKey, $LOCAL_LANG[$languageKey]); // Cache processed data $this->cacheInstance->set($hash, $this->store->getDataByLanguage($fileReference, $languageKey)); return $this->store->getData($fileReference); }
/** * Returns the path (visually) of a page $uid, fx. "/First page/Second page/Another subpage" * Each part of the path will be limited to $titleLimit characters * Deleted pages are filtered out. * * @param int $uid Page uid for which to create record path * @param string $clause is additional where clauses, eg. * @param int $titleLimit Title limit * @param int $fullTitleLimit Title limit of Full title (typ. set to 1000 or so) * @return mixed Path of record (string) OR array with short/long title if $fullTitleLimit is set. */ public static function getRecordPath($uid, $clause = '', $titleLimit = 1000, $fullTitleLimit = 0) { if ($clause !== '' || (int) $titleLimit !== 1000 || (int) $fullTitleLimit !== 0) { GeneralUtility::deprecationLog('The arguments "clause", "tileLimit" and "fullTitleLimit" ' . 'have been deprecated since TYPO3 CMS 8 and will be removed in TYPO3 CMS 9'); } $uid = (int) $uid; $output = $fullOutput = '/'; if ($uid === 0) { return $output; } $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); $queryBuilder->getRestrictions()->removeAll(); $clause = trim($clause); $loopCheck = 100; while ($loopCheck > 0) { $loopCheck--; $queryBuilder->select('uid', 'pid', 'title', 'deleted', 't3ver_oid', 't3ver_wsid')->from('pages')->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT))); if (!empty($clause)) { $queryBuilder->andWhere($clause); } $row = $queryBuilder->execute()->fetch(); if ($row !== false) { BackendUtility::workspaceOL('pages', $row); if (is_array($row)) { BackendUtility::fixVersioningPid('pages', $row); $uid = (int) $row['pid']; $output = '/' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], $titleLimit)) . $output; if ($row['deleted']) { $output = '<span class="text-danger">' . $output . '</span>'; } if ($fullTitleLimit) { $fullOutput = '/' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($row['title'], $fullTitleLimit)) . $fullOutput; } } else { break; } } else { break; } } if ($fullTitleLimit) { return [$output, $fullOutput]; } else { return $output; } }
/** * @param array $arguments * @param \Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return mixed|string * @throws Exception */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $value = $arguments['value']; $default = $arguments['default']; $viewHelperVariableContainer = $renderingContext->getViewHelperVariableContainer(); if ($default !== false) { GeneralUtility::deprecationLog('Argument "default" on f:case is deprecated - use f:defaultCase instead'); } if ($value === null && $default === false) { throw new Exception('The case View helper must have either value or default argument', 1382867521); } $expression = $viewHelperVariableContainer->get(OriginalSwitchViewHelper::class, 'switchExpression'); // non-type-safe comparison by intention if ($default === true || $expression == $value) { $viewHelperVariableContainer->addOrUpdate(OriginalSwitchViewHelper::class, 'break', true); return $renderChildrenClosure(); } return ''; }
/** * @param string $path * @param string $extensionKey * @param string $name (deprecated, just use $path instead) * @return string * @throws Exception */ public function render($path = NULL, $extensionKey = NULL, $name = NULL) { if (NULL !== $path) { $pathToExtract = $path; } elseif (NULL !== $name) { $pathToExtract = $name; GeneralUtility::deprecationLog('v:variable.extensionConfiguration was called with parameter "name" which is deprecated. Use "path" instead.'); } else { throw new Exception('v:variable.extensionConfiguration requires the "path" attribute to be filled.', 1446998437); } if (NULL === $extensionKey) { $extensionName = $this->controllerContext->getRequest()->getControllerExtensionName(); $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName); } if (FALSE === array_key_exists($extensionKey, $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'])) { return NULL; } $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]); return $this->extractFromArrayByPath($extConf, $path); }
/** * @param string $identifier * @param string $size "large", "small" or "default", see the constants of the Icon class * @param string $overlayIdentifier * @param IconState $state * @return Icon */ public function getIcon($identifier, $size = Icon::SIZE_DEFAULT, $overlayIdentifier = null, IconState $state = null) { if ($this->iconRegistry->isDeprecated($identifier)) { $deprecationSettings = $this->iconRegistry->getDeprecationSettings($identifier); GeneralUtility::deprecationLog(sprintf($deprecationSettings['message'], $identifier)); if (!empty($deprecationSettings['replacement'])) { $identifier = $deprecationSettings['replacement']; } } if (!$this->iconRegistry->isRegistered($identifier)) { $identifier = $this->iconRegistry->getDefaultIconIdentifier(); } $iconConfiguration = $this->iconRegistry->getIconConfigurationByIdentifier($identifier); $iconConfiguration['state'] = $state; $icon = $this->createIcon($identifier, $size, $overlayIdentifier, $iconConfiguration); /** @var IconProviderInterface $iconProvider */ $iconProvider = GeneralUtility::makeInstance($iconConfiguration['provider']); $iconProvider->prepareIconMarkup($icon, $iconConfiguration['options']); return $icon; }
/** * Download a file * * @param string $file Path to the file * @param array $configuration configuration used to render the filelink cObject * @param bool $hideError define if an error should be displayed if file not found * * @param string $class optional class * * @param string $target target * * @param string $alt alt text * * @param string $title title text * @return string * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException */ public function render($file, $configuration = [], $hideError = false, $class = '', $target = '', $alt = '', $title = '') { GeneralUtility::deprecationLog('The ViewHelper "format.fileDownload" of EXT:news is deprecated! Just use the native implementation of FAL'); if (!is_file($file)) { $errorMessage = sprintf('Given file "%s" for %s is not valid', htmlspecialchars($file), get_class()); GeneralUtility::devLog($errorMessage, 'news', GeneralUtility::SYSLOG_SEVERITY_WARNING); if (!$hideError) { throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException('Given file is not a valid file: ' . htmlspecialchars($file)); } } $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class); $fileInformation = pathinfo($file); $fileInformation['file'] = $file; $fileInformation['size'] = filesize($file); $cObj->data = $fileInformation; // set a basic configuration for cObj->filelink $tsConfiguration = ['path' => $fileInformation['dirname'] . '/', 'ATagParams' => 'class="download-link basic-class ' . strtolower($fileInformation['extension']) . (!empty($class) ? ' ' . $class : '') . '"', 'labelStdWrap.' => ['cObject.' => ['value' => $this->renderChildren()]]]; // Fallback if no configuration given if (!is_array($configuration)) { $configuration = ['labelStdWrap.' => ['cObject' => 'TEXT']]; } else { /** @var $typoscriptService TypoScriptService */ $typoscriptService = GeneralUtility::makeInstance(TypoScriptService::class); $configuration = $typoscriptService->convertPlainArrayToTypoScriptArray($configuration); } // merge default configuration with optional configuration \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($tsConfiguration, $configuration); if (!empty($target)) { $tsConfiguration['target'] = $target; } if (!empty($alt)) { $tsConfiguration['altText'] = $alt; } if (!empty($title)) { $tsConfiguration['title'] = $title; } // generate link $link = $cObj->filelink($fileInformation['basename'], $tsConfiguration); return $link; }
/** * Find all Configuration/TCA/* files of extensions and create base TCA from it. * The filename must be the table name in $GLOBALS['TCA'], and the content of * the file should return an array with content of a specific table. * * @return void * @see Extension core, extensionmanager and others for examples. */ protected static function buildBaseTcaFromSingleFiles() { $GLOBALS['TCA'] = array(); $activePackages = static::$packageManager->getActivePackages(); // First load "full table" files from Configuration/TCA foreach ($activePackages as $package) { $tcaConfigurationDirectory = $package->getPackagePath() . 'Configuration/TCA'; if (is_dir($tcaConfigurationDirectory)) { $files = scandir($tcaConfigurationDirectory); foreach ($files as $file) { if (is_file($tcaConfigurationDirectory . '/' . $file) && $file !== '.' && $file !== '..' && substr($file, -4, 4) === '.php') { $tcaOfTable = (require $tcaConfigurationDirectory . '/' . $file); if (is_array($tcaOfTable)) { // TCA table name is filename without .php suffix, eg 'sys_notes', not 'sys_notes.php' $tcaTableName = substr($file, 0, -4); $GLOBALS['TCA'][$tcaTableName] = $tcaOfTable; } } } } } // Apply category stuff CategoryRegistry::getInstance()->applyTcaForPreRegisteredTables(); // Execute override files from Configuration/TCA/Overrides foreach ($activePackages as $package) { $tcaOverridesPathForPackage = $package->getPackagePath() . 'Configuration/TCA/Overrides'; if (is_dir($tcaOverridesPathForPackage)) { $files = scandir($tcaOverridesPathForPackage); foreach ($files as $file) { if (is_file($tcaOverridesPathForPackage . '/' . $file) && $file !== '.' && $file !== '..' && substr($file, -4, 4) === '.php') { require $tcaOverridesPathForPackage . '/' . $file; } } } } // TCA migration // @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8. This can be removed *if* no additional TCA migration is added with CMS 8, see class TcaMigration $tcaMigration = GeneralUtility::makeInstance(TcaMigration::class); $GLOBALS['TCA'] = $tcaMigration->migrate($GLOBALS['TCA']); $messages = $tcaMigration->getMessages(); if (!empty($messages)) { $context = 'Automatic TCA migration done during bootstrap. Please adapt TCA accordingly, these migrations' . ' will be removed with TYPO3 CMS 8. The backend module "Configuration -> TCA" shows the modified values.' . ' Please adapt these areas:'; array_unshift($messages, $context); GeneralUtility::deprecationLog(implode(LF, $messages)); } static::emitTcaIsBeingBuiltSignal($GLOBALS['TCA']); }
/** * @test */ public function deprecationLogFixesPermissionsOnLogFile() { if (TYPO3_OS == 'WIN') { $this->markTestSkipped('deprecationLogFixesPermissionsOnLogFile() test not available on Windows.'); } // Fake all required settings and get an unique logfilename $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = uniqid('test_'); $deprecationLogFilename = Utility\GeneralUtility::getDeprecationLogFileName(); $GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog'] = TRUE; $GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask'] = '0777'; // Call method, get actual permissions and clean up Utility\GeneralUtility::deprecationLog('foo'); clearstatcache(); $resultFilePermissions = substr(decoct(fileperms($deprecationLogFilename)), 2); @unlink($deprecationLogFilename); $this->assertEquals($resultFilePermissions, '0777'); }
/** * Returns the label-value for fieldname $col in table, $table * If $printAllWrap is set (to a "wrap") then it's wrapped around the $col value IF THE COLUMN $col DID NOT EXIST in TCA!, eg. $printAllWrap = '<strong>|</strong>' and the fieldname was 'not_found_field' then the return value would be '<strong>not_found_field</strong>' * * @param string $table Table name, present in $GLOBALS['TCA'] * @param string $col Field name * @param string $printAllWrap Wrap value - set function description - this parameter is deprecated since TYPO3 6.2 and is removed two versions later. This paramater is a conceptual failure, as the content can then never be HSCed afterwards (which is how the method is used all the time), and then the code would be HSCed twice. * @return string or NULL if $col is not found in the TCA table */ public static function getItemLabel($table, $col, $printAllWrap = '') { // Check if column exists if (is_array($GLOBALS['TCA'][$table]) && is_array($GLOBALS['TCA'][$table]['columns'][$col])) { return $GLOBALS['TCA'][$table]['columns'][$col]['label']; } if ($printAllWrap) { GeneralUtility::deprecationLog('The third parameter of getItemLabel() is deprecated with TYPO3 CMS 6.2 and will be removed two versions later.'); $parts = explode('|', $printAllWrap); return $parts[0] . $col . $parts[1]; } return NULL; }
/** * Returns the package meta data object of this package. * * @return MetaData */ public function getPackageMetaData() { if ($this->packageMetaData === null) { $this->packageMetaData = new MetaData($this->getPackageKey()); $this->packageMetaData->setDescription($this->getValueFromComposerManifest('description')); $this->packageMetaData->setVersion($this->getValueFromComposerManifest('version')); $requirements = $this->getValueFromComposerManifest('require'); if ($requirements !== null) { foreach ($requirements as $requirement => $version) { $packageKey = $this->packageManager->getPackageKeyFromComposerName($requirement); // dynamically migrate 'cms' dependency to 'core' dependency // see also \TYPO3\CMS\Extensionmanager\Utility\ExtensionModelUtility::convertDependenciesToObjects if ($packageKey === 'cms') { GeneralUtility::deprecationLog('Extension "' . $this->packageKey . '" defines a dependency on ext:cms, which has been removed. Please remove the dependency.'); $packageKey = 'core'; } $constraint = new MetaData\PackageConstraint(MetaData::CONSTRAINT_TYPE_DEPENDS, $packageKey); $this->packageMetaData->addConstraint($constraint); } } $suggestions = $this->getValueFromComposerManifest('suggest'); if ($suggestions !== null) { foreach ($suggestions as $suggestion => $version) { $packageKey = $this->packageManager->getPackageKeyFromComposerName($suggestion); $constraint = new MetaData\PackageConstraint(MetaData::CONSTRAINT_TYPE_SUGGESTS, $packageKey); $this->packageMetaData->addConstraint($constraint); } } } return $this->packageMetaData; }
/** * Gets the document's score. * * @param string $document The result document as serialized array * @return float The document's score * @throws RuntimeException if the serialized result document array cannot be unserialized */ protected function getScore($document) { $rawDocument = $document; $score = 0; if (is_numeric($document)) { // backwards compatibility \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('You are using an old notation of the ' . 'releavnace view helpers. The notation used to be ' . '###RELEVANCE:###RESULT_DOCUMENT.SCORE######, please change ' . 'this to simply provide the whole result document: ' . '###RELEVANCE:###RESULT_DOCUMENT######'); return $document; } $document = unserialize($document); if (is_array($document)) { $score = $document['score']; } else { if ($rawDocument == '###RESULT_DOCUMENT###') { // unresolved marker // may happen when using search.spellchecking.searchUsingSpellCheckerSuggestion // -> ignore } else { $solrConfiguration = Tx_Solr_Util::getSolrConfiguration(); if ($solrConfiguration['logging.']['exceptions']) { \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Could not resolve document score for relevance calculation', 'solr', 3, array('rawDocument' => $rawDocument, 'unserializedDocument' => $document)); } throw new RuntimeException('Could not resolve document score for relevance calculation', 1343670545); } } return $score; }
/** * Creating the module output. * * @throws \UnexpectedValueException * @return void */ public function main() { $lang = $this->getLanguageService(); $this->content .= '<form action="" name="editForm" id="NewContentElementController"><input type="hidden" name="defValues" value="" />'; if ($this->id && $this->access) { // Init position map object: $posMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\ContentCreationPagePositionMap::class); $posMap->cur_sys_language = $this->sys_language; // If a column is pre-set: if (isset($this->colPos)) { if ($this->uid_pid < 0) { $row = array(); $row['uid'] = abs($this->uid_pid); } else { $row = ''; } $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language); } else { $this->onClickEvent = ''; } // *************************** // Creating content // *************************** $this->content .= '<h1>' . $lang->getLL('newContentElement') . '</h1>'; // Wizard $wizardItems = $this->wizardArray(); // Wrapper for wizards $this->elementWrapper['section'] = array('', ''); // Hook for manipulating wizardItems, wrapper, onClickEvent etc. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) { $hookObject = GeneralUtility::getUserObj($classData); if (!$hookObject instanceof NewContentElementWizardHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface ' . NewContentElementWizardHookInterface::class, 1227834741); } $hookObject->manipulateWizardItems($wizardItems, $this); } } // Add document inline javascript $this->moduleTemplate->addJavaScriptCode('NewContentElementWizardInlineJavascript', ' function goToalt_doc() { // ' . $this->onClickEvent . ' } if(top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); }'); $iconRegistry = GeneralUtility::makeInstance(IconRegistry::class); // Traverse items for the wizard. // An item is either a header or an item rendered with a radio button and title/description and icon: $cc = $key = 0; $menuItems = array(); foreach ($wizardItems as $k => $wInfo) { if ($wInfo['header']) { $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]); $key = count($menuItems) - 1; } else { $content = ''; if (!$this->onClickEvent) { // Radio button: $oC = 'document.editForm.defValues.value=unescape(' . GeneralUtility::quoteJSvalue(rawurlencode($wInfo['params'])) . ');goToalt_doc();' . (!$this->onClickEvent ? 'window.location.hash=\'#sel2\';' : ''); $content .= '<div class="media-left"><input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($oC) . '" /></div>'; // Onclick action for icon/title: $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $oC . 'return false;'; } else { $aOnClick = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : ''); } if (isset($wInfo['icon'])) { GeneralUtility::deprecationLog('The PageTS-Config: mod.wizards.newContentElement.wizardItems.*.elements.*.icon' . ' is deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8.' . ' Register your icon in IconRegistry::registerIcon and use the new setting:' . ' mod.wizards.newContentElement.wizardItems.*.elements.*.iconIdentifier'); $wInfo['iconIdentifier'] = 'content-' . $k; $icon = $wInfo['icon']; if (StringUtility::beginsWith($icon, '../typo3conf/ext/')) { $icon = str_replace('../typo3conf/ext/', 'EXT:', $icon); } if (!StringUtility::beginsWith($icon, 'EXT:') && strpos($icon, '/') !== false) { $icon = TYPO3_mainDir . GeneralUtility::resolveBackPath($wInfo['icon']); } $iconRegistry->registerIcon($wInfo['iconIdentifier'], BitmapIconProvider::class, array('source' => $icon)); } $icon = $this->moduleTemplate->getIconFactory()->getIcon($wInfo['iconIdentifier'])->render(); $menuItems[$key]['content'] .= ' <div class="media"> <a href="#" onclick="' . htmlspecialchars($aOnClick) . '"> ' . $content . ' <div class="media-left"> ' . $icon . ' </div> <div class="media-body"> <strong>' . htmlspecialchars($wInfo['title']) . '</strong>' . '<br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</div> </a> </div>'; $cc++; } } // Add closing section-tag foreach ($menuItems as $key => $val) { $menuItems[$key]['content'] .= $this->elementWrapper['section'][1]; } // Add the wizard table to the content, wrapped in tabs $code = '<p>' . $lang->getLL('sel1', 1) . '</p>' . $this->moduleTemplate->getDynamicTabMenu($menuItems, 'new-content-element-wizard'); $this->content .= !$this->onClickEvent ? '<h2>' . $lang->getLL('1_selectType', true) . '</h2>' : ''; $this->content .= '<div>' . $code . '</div>'; // If the user must also select a column: if (!$this->onClickEvent) { // Add anchor "sel2" $this->content .= '<div><a name="sel2"></a></div>'; // Select position $code = '<p>' . $lang->getLL('sel2', 1) . '</p>'; // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: $colPosArray = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getColPosListItemsParsed', $this->id, $this); $colPosIds = array_column($colPosArray, 1); // Removing duplicates, if any $colPosList = implode(',', array_unique(array_map('intval', $colPosIds))); // Finally, add the content of the column selector to the content: $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI); $this->content .= '<h2>' . $lang->getLL('2_selectPosition', true) . '</h2><div>' . $code . '</div>'; } } else { // In case of no access: $this->content = ''; $this->content .= '<h1>' . $lang->getLL('newContentElement') . '</h1>'; } $this->content .= '</form>'; // Setting up the buttons and markers for docheader $this->getButtons(); }
/** * Revive the domain model of the accordant element. * * @param Element $element * @param array $userConfiguredElementTypoScript The configuration array * @param string $elementType The element type (e.g BUTTON) * @return void */ protected function reviveElement(Element $element, array $userConfiguredElementTypoScript, $elementType = '') { // @todo Check $userConfiguredElementTypoScript if ($elementType === 'IMAGEBUTTON') { GeneralUtility::deprecationLog('EXT:form: The element IMAGEBUTTON is deprecated since TYPO3 CMS 7, will be removed with TYPO3 CMS 8.'); } $element->setElementType($elementType); $element->setElementCounter($this->elementCounter->getElementId()); $elementBuilder = ElementBuilder::create($this, $element, $userConfiguredElementTypoScript); $elementBuilder->setPartialPaths(); $elementBuilder->setVisibility(); if ($element->getElementType() == 'CONTENTELEMENT') { $attributeValue = ''; if ($this->configuration->getContentElementRendering()) { $attributeValue = $this->formUtility->renderItem($userConfiguredElementTypoScript['cObj.'], $userConfiguredElementTypoScript['cObj']); } $element->setAdditionalArguments(array('content' => $attributeValue)); /* use the compatibility theme whenever if a layout is defined */ if ($this->configuration->getCompatibility()) { $this->compatibilityService->setElementLayouts($element, $userConfiguredElementTypoScript); if (isset($userConfiguredElementTypoScript['layout'])) { $this->configuration->setThemeName(static::COMPATIBILITY_THEME_NAME); unset($userConfiguredElementTypoScript['layout']); } } } else { $this->setAttributes($elementBuilder, $element, $userConfiguredElementTypoScript); $userConfiguredElementTypoScript = $elementBuilder->getUserConfiguredElementTypoScript(); $this->setValidationMessages($element); /* use the compatibility theme whenever if a layout is defined */ if ($this->configuration->getCompatibility()) { $this->compatibilityService->setElementLayouts($element, $userConfiguredElementTypoScript); if (isset($userConfiguredElementTypoScript['layout'])) { $this->configuration->setThemeName(static::COMPATIBILITY_THEME_NAME); unset($userConfiguredElementTypoScript['layout']); } } $this->signalSlotDispatcher->dispatch(__CLASS__, 'txFormAfterElementCreation', array($element, $this)); // create all child elements $this->setChildElementsByIntegerKey($element, $userConfiguredElementTypoScript); } }