I have written some ViewHelpers that work totally fine, but only in the Main-Section... For better understanding:
<f:section name="Configuration">
<flux:field.select name="first" label="first" items="{0: '10', 1: '40'}"/>
<flux:field.select name="second" label="second" items="{myViewHelpers:load()}"/>
</f:section>
<f:section name="Preview">
</f:section>
<f:section name="Main">
{myViewHelpers:load()}
</f:section>
{myViewHelpers:load()}
returns a string, with for example
{0: '10', 1: '40'}
In the Main-Section this perfectly works, but if I use the same ViewHelper in the Configuration-section, it just doesn't load the backend any more... I only get a blank field in Typo3, where normally the element arises.
I'd be grateful for any suggestions!
Your ViewHelper returns a string that is in return interpreted by fluid as an array (curly braces). So fluid prints out nothing. Are you sure you don't need to pass that array to another ViewHelper like flux:field.select
?
If you need to generate a usable array from your ViewHelper you should use
$templateVariableContainer = $renderingContext->getTemplateVariableContainer();
$templateVariableContainer->add($arguments['myNewVariable'], $array);
Then you can access your variable like you normally would:
{myNewVariable.0}