[TYPO3-mvc] Using extbase plugin as configuration for another extbase plugin ?

Claus Due claus at wildside.dk
Thu Mar 15 12:39:50 CET 2012


Hi Adrien,

That is an interesting proposition!

Have you considered delegating the Toolbar and Data views to Widgets
which can be configured easily through an array of settings? You would
have one controller per Widget and this controller could for example use
configuration from another plugin.

I suggest this as a possible strategy:

- Use Widgets to render the Toolbar and Data plugins. You can then
render one or both Widgets through one or more controllers as required.

- Use a FlexForm field in the plugin that should be able to access the other
plugin's settings, a group/select pointing to tt_content, optionally with clauses
to limit what you can select (fx by the list_type wanted)

- In your Widget's controller make the necessary decisions about wether
or not to display and the necessary logic to a) select the record that was
pointed to and b) take the stored settings (flexform XML I assume) then
finally c) parse those FlexForm settings and override/overlay/whatever
those settings before rendering your Widget's template.

Note: I suggest Widgets here instead of just controllers and fx action
forwarding because it sounds like you want to include your Toolbar output
inside the template of your Data plugin.

The benefit would be that each Widget works almost like a plugin but does
not require additional bootstrapping etc. in order to - just as an example -
render the Toolbar Widget from inside the Data Widget if there is a
Toolbar plugin on the same page - and in the Toolbar plugin prevent
rendering if there is a Data plugin on the same page. Bonus is that if you
use Widget arguments instead of Controller arguments, both Widgets
will be able to accept new/added arguments even when rendered inside
another Widget.

The FlexForm Service in EXT:flux might be helpful if you are already using
Flux - but nothing I suggest above requires more than Extbase and Fluid ;)

--
Cheers,
Claus
http://fedext.net

On Mar 15, 2012, at 1:48 AM, Adrien Crivelli wrote:

> Hello,
> 
> I recently completed two extbase plugins in my extension. Let's call them
> "Toolbar" and "Data". On one page (FE) I have both Toolbar and Data and
> basically Toolbar controls what Data will show.
> 
> Now, the reason I splitted Toolbar and Data in two plugins is because in
> some cases I want to only have Data on the page, so the visitor cannot
> control what will be displayed. But I want the administrator to be able to
> pre-configure Data via the backend. So I am looking for a way to re-use my
> Toolbar plugin in the backend as configuration for my Data plugin. This
> would have the huge benefits of not duplicating code and keep a consistent
> UI for FE and BE.
> 
> I had a look at
> FlexForms<http://www.snippit.net/typoscript/reference/flexform-basics.html>and
> Flux <http://fedext.net/examples/flux/features.html>, but I am quite new to
> all this and can't figure out where to go from there... I thought maybe I
> would need to use userFunc and then mannually bootstrap Extbase and
> dispatch a request to generate my Toolbar. But that seems quite complicated
> and was wondering if there was anything more straightforward ? Or if
> anybody had similar needs ?
> 
> TIA,
> 
> Adrien
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list