In TYPO3 6.x, what is an easy way to quickly create custom content elements?
A typical example (Maybe for a collection of testimonials):
In the backend (with adequate labels):
- An image
- An input field
- A textarea
When rendering:
- Image resized to xy
- input wrapped in h2
- textarea passed through parseFunc and wrapped in more markup
Ideally, these would be available in the page module as cType, but at least in the list module. And use fluid templates.
My questions:
From another CMS I am used to content item templates being applied to the BE and the FE at the same time (you write the template for what it should do, and then there's a backend item just for that type of content element) - but that's not how fluid works - or can it be done?
Is there an extension that would handle such custom content elements (other than Templavoila)?
Or do I have to create a custom extbase/fluid extension for each such field type?
And, by the way: is there a recommendable tutorial for the new extbase kickstarter? I got scared away by all that domain modelling stuff.
I think http://typo3.org/extensions/repository/view/dce will do exactly what I was looking for
That scaring domain modeling stuff is probably best option for you :)
Create an extension with FE plugin which holds and displays data as you want, so you can place it as a "Insert plugin". It's possible to add this plugin as a custom CType and I will find a sample for you, but little bit later.
Note, you don't need to create additional models as you can store required data ie. in FlexForm.
From FE plugin to CType
Let's consider that you have an extension with key
hello
which containsNews
controller withlist
andsingle
actions in it.In your
ext_tables.php
you have registered a FE plugin:When it's working fine you can add it to the list of content types (available in TCA) just by adding fifth param to the
configurePlugin
method in yourext_localconf.php
:Next part (basing on this site) is adding your plugin to the New Content Element Wizard as noticed in TYPO3 Wiki since TYPO3 ver. 6.0.0 changed a little, so easiest way is adding something like this into your
ext_tables.php
:and in
/typo3conf/ext/hello/Configuration/TypoScript/pageTsConfig.ts
file write add this:Note that proper key
tx_hello_news
should be combination of lowercasedtx_
,$_EXTKEY
and plugin name - used inregisterPlugin
method.You can stop here if you are bored ;)
Bring tt_content's fields back into your CType
Above steps will cause that no typical fields will be available in the TCA for your element, so you need to copy something or create own. To see how it works just see some sample, in the backend in left menu choose
ADMIN TOOLS
>Configuration
>TCA
>tt_content
>types
There you'll find all types in the system, choose the most required and copy its
[showitem]
node into your own. Again inext_tables.php
add this PHP array:Again:
hello_news
is combination of lowercased$_EXTKEY
and FE plugin name...Of course if it's required you can compose quite own set of fields, one by one by custom string:
Access the fields in Extbase Controller:
Fortunately is easiest part as you can just access it as an Array: