[TYPO3-mvc] Is there a general viewhelper for 10.value={text} 10.typolink.parameter={destination}?

Andreas Kiessling kiessling at pluspol.info
Tue Aug 28 18:17:07 CEST 2012


Hi Martin,

On 28.08.2012 11:51, Martin Bless wrote:
> Hi Andreas [Kiessling],
> hi Sebastian [Schreiber],
> 
>> So in your case, this should work
>>
>> <f:cObject typoscriptObjectPath="lib.doTheWork" data="{dest1: dest1,
>> more1: more1}" />
>>
>> Now you should be able to access the values from TS like from a regular
>> cObject
>>
>> 10 = TEXT
>> 10.field = more1
>> 10.typolink.parameter.field = dest1
> 
> 
> Hhm, I must say that I'm in the fluid template of a
> wec_contentelements(_demo) element. I don't understand the above.
> 
> Q: Where do I find information about that "data" parameter?

Data is just array(-like) data, that you can access from TypoScript with
".field".

> 
> Q: Isn't "data" just presetting the real "data" of the content element
>    cObject?

What do you mean with "real data"? The one from the current content
element? Or the one, that is accessible from your rendered lib?

When you use FLUIDTEMPLATE outside of extbase (that means through
TypoScript), it will automatically get the data of the current content
object as "data", so you should be able to use use e.g. {data.uid} etc.
in the template. I'm not sure about flexform data.

If you want to use that data in a cObject ViewHelper, you probably have
to pass it on in the data attribute data="{data}"
So then you could use it like this

10 = TEXT
10.field = uid


"The book" also contains some examples about how to pass data from fluid
to TS
http://srv123.typo3.org/~mbless/git.typo3.org/Documentation/TYPO3/Book/ExtbaseFluid.git/extbase-fluid-book/_genesis/trunk/Documentation/_build/html/8-Fluid/5-using-typoscript-for-rendering-the-cobject-viewhelper.html

The last comment from Steffen is also a perfect solution to your problem:
http://www.t3node.com/blog/combining-fluid-viewhelpers-and-typoscript-in-typo3-5-basic-examples/

> 
> To remember, here's what I'm trying to do:
> 
> I'm looking for a replacement for:
> 
>   10 = TEXT
>   10.value = {more1}
>   10.typolink.parameter = {dest1}
> 
> 
> 'more' and 'dest1' are flexform values stored in

And that should work, if you use "field", and not just value and parameter.
With data="{a: 'string a', b: 'string b'} you just set the data array,
that will be available from TS. You can either pass a complete domain
model (which will be converted to an array) or create the array on your
own (e.g. from flexform data)

Then you can use
10 = TEXT
10.field = a

This should just give you an output as "string a"


HTH,
Andreas


More information about the TYPO3-project-typo3v4mvc mailing list