0

私は完全に正常に動作するいくつかの ViewHelpers を作成しましたが、メインセクションでのみ... 理解を深めるために:

<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()}たとえば、文字列を返します

{0: '10', 1: '40'}

Main-Section ではこれは完全に機能しますが、Configuration-section で同じ ViewHelper を使用すると、バックエンドが読み込まれなくなります...通常は要素が発生する Typo3 で空白のフィールドしか取得しません。

何か提案があればよろしくお願いします!

4

1 に答える 1

0

ViewHelper が返す文字列は、fluid によって配列 (中括弧) として解釈されます。したがって、 fluid は何も出力しません。その配列を別の ViewHelper のようなものに渡す必要はありませんflux:field.selectか?

ViewHelper から使用可能な配列を生成する必要がある場合は、使用する必要があります

$templateVariableContainer = $renderingContext->getTemplateVariableContainer();
$templateVariableContainer->add($arguments['myNewVariable'], $array);

その後、通常どおりに変数にアクセスできます。

{myNewVariable.0}
于 2016-07-02T11:10:39.193 に答える