0
votes

I have a template extension on TYPO3 8.7 and try to add some custom content elements. Everything seems to work fine, except for the backend fields - they're just not rendered.

I developed the extension from scratch and thought that maybe that was the problem, so I installed the Extension Builder module and made another extension with it, but the result is still the same.

The extension structure:

    ├── Classes
    │   ├── Controller
    │   └── Domain
    │       ├── Model
    │       │   └── Basic.php
    │       └── Repository
    │           └── BasicRepository.php
    ├── Configuration
    │   ├── ExtensionBuilder
    │   │   └── settings.yaml
    │   ├── PageTSconfig
    │   │   └── tsconfig.txt
    │   ├── TCA
    │   │   ├── Overrides
    │   │   │   ├── pages.php
    │   │   │   └── tt_content.php
    │   │   └── tx_mytest_domain_model_basic.php
    │   └── Typoscript
    │       ├── contsants.typoscript
    │       └── setup.typoscript
    ├── Documentation.tmpl
    ├── ExtensionBuilder.json
    ├── Resources
    │   ├── Private
    │   │   ├── Language
    │   │   │   ├── Tca.xlf
    │   │   │   ├── locallang.xlf
    │   │   │   └── locallang_db.xlf
    │   │   ├── Layouts
    │   │   │   ├── Default.html
    │   │   │   └── Page.html
    │   │   ├── Partials
    │   │   │   ├── Assets.html
    │   │   │   ├── Footer.html
    │   │   │   ├── Header.html
    │   │   │   ├── SearchBox.html
    │   │   │   └── Sidebar.html
    │   │   └── Templates
    │   │       ├── Content
    │   │       │   ├── Counter.html
    │   │       │   └── Slider.html
    │   │       └── Page
    │   │           └── Default.html
    │   └── Public
    │       ├── Icons
    │       │   ├── blue.png
    │       │   ├── relation.gif
    │       │   └── tx_mytest_domain_model_basic.gif
    │       └── assets -> ../../../../../../templates/project/app/assets
    ├── Tests
    ├── composer.json
    ├── ext_emconf.php
    ├── ext_localconf.php
    ├── ext_tables.php
    └── ext_tables.sql

ext_localconf.php:

$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);

$iconRegistry->registerIcon('content-icon',
\TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
['source' => 'EXT:my_test/Resources/Public/icons/blue.png']);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
    'mod.wizards.newContentElement.wizardItems.Test {
        header = Test
        elements {
              slider {
                iconIdentifier = content-icon
                 title = LLL:EXT:my_test/Resources/Private/Language/Tca.xlf:myext_slider.wizard.title
                 description = LLL:EXT:my_test/Resources/Private/Language/Tca.xlf:myext_slider.wizard.description
                 tt_content_defValues {
                    CType = slider
                 }
              }
              counter {
                iconIdentifier = content-icon
                title = LLL:EXT:my_test/Resources/Private/Language/Tca.xlf:myext_counter.wizard.title
                description = LLL:EXT:my_test/Resources/Private/Language/Tca.xlf:myext_counter.wizard.description
                tt_content_defValues {
                    CType = counter
                }
             }
        }
        show := addToList(*)
    }'
);

ext_tables.php:

defined('TYPO3_MODE') || die('Access denied.');

call_user_func(
    function()
    {

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('my_test', 'Configuration/TypoScript', 'Test');

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_mytest_domain_model_basic', 'EXT:my_test/Resources/Private/Language/locallang_csh_tx_mytest_domain_model_basic.xlf');
    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_mytest_domain_model_basic');

}

setup.typoscript:

<INCLUDE_TYPOSCRIPT: source="FILE:EXT:fluid_styled_content/Configuration/TypoScript/setup.txt">

page = PAGE
page {
   typeNum = 0

      10 = FLUIDTEMPLATE
   10 {
      templateName = TEXT
         templateName.stdWrap.cObject = CASE
         templateName.stdWrap.cObject {
            key.data = pagelayout

            pagets__site_package_default = TEXT
            pagets__site_package_default.value = Default

            default = TEXT
            default.value = Default
         }
         templateRootPaths {
            0 = EXT:my_test/Resources/Private/Templates/Page/
            1 = {$page.fluidtemplate.templateRootPath}
         }
         partialRootPaths {
            0 = EXT:my_test/Resources/Private/Partials/
            1 = {$page.fluidtemplate.partialRootPath}
         }
         layoutRootPaths {
            0 = EXT:my_test/Resources/Private/Layouts/
            1 = {$page.fluidtemplate.layoutRootPath}
         }

   }
}

lib.contentElement {
   templateRootPaths {
      20 = EXT:my_test/Resources/Private/Templates/Content/
   }
}

tt_content.counter =< lib.contentElement
tt_content.counter {
    templateName = Counter
}

tt_content.slider =< lib.contentElement
tt_content.slider {
    templateName = Slider
}
);

TCA/Overrides/tt_content.php:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
    array(
        'LLL:EXT:my_test/Resources/Private/Language/Tca.xlf:myext_slider',
        'slider',
        'EXT:my_test/Resources/Public/icons/blue.png'
    ),
    'CType',
    'Myext'
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
    array(
       'LLL:EXT:my_test/Resources/Private/Language/Tca.xlf:myext_counter',
        'counter',
        'EXT:my_test/Resources/Public/icons/blue.png'
    ),
    'CType',
    'Myext'
);

Templates/Content/Counter.html:

<html xmlns:flux="http://typo3.org/ns/FluidTYPO3/Flux/ViewHelpers" flux:schemaLocation="http://fluidtypo3.org/schemas/flux-development.xsd"
  xmlns:fcc="http://typo3.org/ns/FluidTYPO3/FluidcontentCore/ViewHelpers" fcc:schemaLocation="http://fluidtypo3.org/schemas/fluidcontent_core-development.xsd"
  xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers" v:schemaLocation="http://fluidtypo3.org/schemas/vhs-development.xsd"
  xmlns:f="http://typo3.org/ns/fluid/ViewHelpers" f:schemaLocation="http://fluidtypo3.org/schemas/fluid-master.xsd">
<f:layout name="Default"/>
<f:section name="Configuration">
    <flux:form id="counter"
           label="counter"
           description="Counter description">
        <flux:form.option.icon value="EXT:my_test/Resources/Public/icons/blue.png"/>
        <flux:form.option.group value="Test" />
        <flux:form.section name="counters" label="Counter">
            <flux:form.object name="item" label="Counter item">
                <flux:field.input name="title" label="Counter title" placeholder="Counter title" required="true" />
            </flux:form.object>
        </flux:form.section>
    </flux:form>
</f:section>
<f:section name="Preview"></f:section>
<f:section name="Main">
    <h1>Counter check!</h1>
</f:section>
</html>

The element can be seen in the Wizard and is rendered in the frontend, but when I want to edit it in the backend it has no backend fields, except for the dropdown list with the element types. I guess I didn't add some configuration in order to make it work, but I just have no clue what it could be.

1

1 Answers

1
votes

I solved the problem. The following line was missing in ext_localconf.php:

\FluidTYPO3\Flux\Core::registerProviderExtensionKey('MyTest.my_test', 'Content');

Then I don't need the code in tt_content.php, cause the items that it adds to the dropdown list have nothing to do with the backend layouts. New content elements are added to the dropdown list automatically from the template files and the following information is used for it:

<flux:form id="counter"
           label="counter"
           description="Counter description">