Adding a custom page settings field to TYPO3

Please, help,

I created an extension with Extension Builder . In the extension, I included a simple fluid page template.

Then I added a custom page setup window, as described in this post .

(1.add DB-Field in ext_tables.sql; 2. add a TCA definition to extTables.php)

Sorry, the field is not displayed. I tried the suggested method (ext_tables.sql):

$tmp_itm_extended_columns_pages = array(
    'customTemplateClass' => array(
        'exclude' => 0,.....

as well as the version from realurl:

$TCA['pages']['columns'] += array(
    'customTemplateClass' => array(
        'label' => 'customTemplateClass'...

I don’t know how to set up this custom page. Is there a problem combining it with current page templates?

Thanks for the help Mathias

+4
source share
2 answers

TCA "", . .

+3

. , :

1). : myExt/ext_tables.php

$TCA['pages']['columns'] += array(
    'customTemplateClass' => array(
        'label' => 'Custom Template Class',
        'exclude' => 1,
        'config' => array (
            'type' => 'input',
            'max' => 255,
            'eval' => 'trim,nospace,lower'
        ),
    ),
);

2). TCA: myExt/ext_tables.php

t3lib_extMgm::addToAllTCAtypes (
    'pages',
    'customTemplateClass'
);

3). : myExt/ext_tables.sql

CREATE TABLE pages (
    customTemplateClass varchar(255) DEFAULT '' NOT NULL
);

4). : myExt/ext_localconf.php

$rootlinefields = &$GLOBALS["TYPO3_CONF_VARS"]["FE"]["addRootLineFields"];
if($rootlinefields != '')
{
    $rootlinefields .= ' , ';
}
$rootlinefields .= 'customTemplateClass';

5). : TypoScript:

lib.pageconfig {
    customTemplateClass = TEXT
    customTemplateClass {
        value = default
        override {
           required = 1
           data = levelfield : -1 , customTemplateClass, slide  
        }
    }
}

6). Fluid-Template:

{f:cObject(typoscriptObjectPath: 'lib.pageconfig.customTemplateClass')}
+5

Source: https://habr.com/ru/post/1569247/


All Articles