Evil Penguin Evil Penguin - 3 months ago 26
PHP Question

Typo3 add a new option or change existing options in backend for Page Frontend Layout drop down not working

i am clearly missing something, but i can't figure out what. I am developing site on Typo3 CMS v7.6.10. I included my extension configuration in TS template.

In \Configuration\TCA\Overrides\pages.php:

<?php
defined('TYPO3_MODE') or die();

// Add pageTSconfig
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile(
'/**/', // my extension
'Configuration/PageTS/pages.ts',
'My special config'
);


In \Configuration\PageTS\pages.ts: (from question here)

TCEFORM.pages {
layout.altLabels.0 = Normal
layout.altLabels.1 = Startpage
layout.altLabels.2 = Landing page
}


After clearing all cache, reinstalling extension nothing had changed in Edit page - Appearance - Frontend Layout drop down. Am i wrong and this configuration is for something else? This is just an example of me using
TCEFORM.pages
, my attempts to do something with other elements not working too. Do i need to include registered config file? If so, nothing appears in my typoscript template include options.

Answer

I am not sure if you did this but

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile()

"only" registers a PageTSConfig file for the selection in the page property. To include it you have to go to the properties of a page in the resources tab and select your file there (see screenshot). It is then active for this page and all subpages.

Select PageTSConfig in page properties

As an alternative you could use ExtensionManagementUtility::addPageTSConfig() instead. If you pass the <INCLUDE_TYPOSCRIPT string to that function your PageTSConfig will be loaded on every page.