DidacC
DidacC

Reputation: 153

Problem with setting a Plugin as a new CType

In order to have the full power of the TCA's showitem for configuring the back-end form for a plugin, I define it as a new CType, instead of a new list_type of the list CType.

I do this by registering it with addPlugin instead of the default method outlined in the official extension guide, using registerPlugin. In ext_tables.php:

        TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
            [
                // Label.
                'LLL:EXT:my_ext/Resources/Private/Language/locallang.xlf:pi1.name',
                // Plugin key.
                'myext_pi1',
                // Icon.
                'pi1'],
            'CType',
            'my_ext'
        );

Then I can just use, in Configuration/TCA/Overrides/tt_content.php:

 $GLOBALS['TCA']['tt_content']['types']['myext_pi1'] = [
    'showitem' => " ... "]

to configure it's back-end form display as I want. But now, after successfully adding the plugin on a page from the back-end, when I try to view it from the front-end, I get the error:

ERROR: Content Element with uid "284" and type "myext_pi1" has no rendering definition!

It's not doing the usual: loading the controller action assigned to the plugin in ext_localconf.php with ExtensionUtility::configurePlugin (in ext_localconf.php).

Does anybody know what could I do to make it work?

Upvotes: 1

Views: 530

Answers (1)

Jo Hasenau
Jo Hasenau

Reputation: 2684

The point in this case is, that the element does not just "act as if it were a custom content element", but it actually IS a custom content element.

So you will have to provide at least a basic configuration via

tt_content.myext_pi1

If you registered a plugin properly it might be enough to just copy the plugin configuration to the tt_content entry

tt_content.myext_pi1 < plugin.myext_pi1

Upvotes: 3

Related Questions