FluidTYPO3 / fluidcontent

TYPO3 extension Fluidcontent: Fluid Content Element Engine
71 stars 64 forks source link

Using controllerActions -> The default controller for extension "Fluidcontent" and plugin "Content" can not be determined #400

Closed RozbehSharahi closed 7 years ago

RozbehSharahi commented 7 years ago

Hello,

My configuration first:

TYPO3 8.5.1
typo3-ter/fluidcontent 5.1.0
typo3-ter/fluidpages 4.1.0
typo3-ter/flux 8.1.0
typo3-ter/vhs 4.1.0 

Templates:
fluid_styled_content
my_own_extension

Everythings works fine so far, but when i use I get the following message for the content element using this field:

The default controller for extension "Fluidcontent" and plugin "Content" can not be determined

I tried xdebugging through the whole thing and it seems that at some point TYPO3 gets to the point where it tries to render tt_content.fluidcontent_content.20 and then it throws the mentioned exception.

NamelessCoder commented 7 years ago

Hi @RozbehSharahi - <flux:field.controllerActions /> only works in "real" plugins. It controls the switchableControllerActions setting and this is not supported with the delegated rendering that Fluidcontent does. The main reason for this is that the controller action is coupled directly to your template file inside Fluidcontent - so switching the action also switches the template file which would break the Fluidcontent element rendering.

You can achieve a similar behavior by using a selector that sets a variable you then use as name of a section or partial - or by simply changing the "fluid content type" (which is essentially the same as changing the controller action, same as switchableControllerActions would do). And of course you can create a custom plugin, register the plugin or content type as a Flux-enabled plugin and then render your template through that. This way would support switchableControllerActions completely but obviously involves a lot more boilerplate code and demands a custom controller.

Hope this explains the limitation!

RozbehSharahi commented 7 years ago

Hello,

yes I did the second option:

And of course you can create a custom plugin, register the plugin or content type as a Flux-enabled plugin and then render your template through that

I created a new template in a subfolder extactley the same way content templates look (3 section Configuration, Template, Main) and then registered plugin and template through:

Core::registerFluidFlexFormPlugin('MyVendor.MyPlugin', 'plugin_name', 'EXT:my_ext/Resources/Private/Templates/Sample/Show.html', [],
    'Configuration');

I thought that fluidcontent had some magic to notice when a controllerAction viewhelper is used, end will do the magic itself :)

Thank you very much Rozbeh