[TYPO3-dev] Rendering fluid based plugins without typoscript

Jigal van Hemert jigal.van.hemert at typo3.org
Tue Jan 5 11:36:52 CET 2016


Hi,

On 04/01/2016 18:06, NGUYEN Duc Quan wrote:
> I am currently trying to improve the development workflow by optimizing
> my dev skills. I am wondering if it would be possible to render a plugin
> placed in a content element in the BE without the need to define in
> typoscript that the plugin should be rendered.
>
> E.g. I have a Plugin X which has an action sayHelloAction which only
> returns "hello world". When I place the plugin in a content element of a
> page and then open that page in the browser then the string "hello
> world" should be displayed.
> Normally I have to define in typoscript something like
>     page.10 < tx_myPlugin
>
> I want to eliminates the typoscript step in order to have more flexibility.

I assume that your installation is already configured to render the 
standard content elements you place in the backend. If you place a 
'text' content element and enter a heading, text, etcetera this should 
be shown in the frontend.
If this is not the case the information about the FLUIDTEMPLATE object 
someone already pointed to can help you. If you still have problems with 
that please ask here, you will definitely get help with that too.

To create a plugin that you can place on a page just like a standard 
content element it needs to be registered properly.

In ext_tables.php you need to register the plugin:

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
   $_EXTKEY,
   'PluginName',
   'PluginTitle'
);

Technically this will add the plugin to the list of available plugins in 
the backend. It will also add some TCA configuration.

It also needs to be registered in ext_localconf.php :

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
   'Vendor. ' . $_EXTKEY,  //Prefix with vendor to make it unique
   'PluginName', // Same as above!
   array(
     'ControllerName1' => 'action1, action2, action3, action4',
   ),
   // non-cacheable actions
   array(
     'ControllerName2' => 'action1, action3',
   )
);

Technically this will add some TypoScript to the system so the frontend 
knows how to call the Extbase dispatcher for this plugin.

A good book to help you with Extbase/Fluid development is:
http://amzn.com/3955391515

-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org



More information about the TYPO3-dev mailing list