テンプレートのブループリントファイルで、リピーター/リストフィールドを使用したいのですが、
オプション付きの選択フィールドがあり、
ユーザーが選択した選択肢を評価して、それに応じてフィールドを表示する条件付きフィールド。
ユーザーがさまざまなタイプのコンポーネントを追加/切り替えできる長い記事にこれを使用したいと思います
条件を選択フィールドの値に(繰り返し)設定するにはどうすればよいですか?
コードが表示されるようになったため、selectのみが表示され、条件は効果がありません。
header.field.selection:
type: list
style: vertical
label: Repeater/list with conditional field selection
fields:
.select: # this select sets the boolean for the conditional fields
type: select
size: long
classes: fancy
label: Select the type of field you would like to add
options:
tinymce: Textarea
slideshow: Slideshow
testimonial: Testimonial
video: Video
.tinymce:
type: conditional # if Textarea was selected render the tinymce fields
condition: "header.field.selection.select is same as('tinymce') ? 'true' : 'false'"
fields:
.fieldName:
type: text
label: Tinymce
.slideshow:
type: conditional # if slideshow was selected render the slideshow fields
condition: "header.field.selection.select is same as('slideshow') ? 'true' : 'false'"
fields:
.fieldName2:
type: text
label: Slideshow
.testimonial:
type: conditional # if testimonial was selected render the testimonial fields
condition: "header.field.selection.select is same as('testimonial') ? 'true' : 'false'"
fields:
.fieldName3:
type: text
label: Testimonial
.video:
type: conditional # if video was selected render the video fields
condition: "header.field.selection.select is same as('video') ? 'true' : 'false'"
fields:
.fieldName4:
type: text
label: Video
条件付きフィールドは、他のフィールドに基づいて「ライブ」で機能するものではありません。サービスを受けるときにPHP関数を実行し、決定を下すことができます。 それ以外の場合は、Javascriptを実行する必要があります。
rhuksterに感謝します。
私はなんとか「フレキシブルコンテンツフィールド」**(Wordpressの高度なカスタムフィールドのような)を作ることができました。 あなたはここでコードを見ることができ
**サブフィールド(レイアウト)のグループを定義し、それらを追加、編集、および並べ替えて、高度にカスタマイズされたコンテンツを作成します。
このようなものをFormプラグインのコアフィールドとして見たいと思います:)PRおそらく??
@rhukster
ブランチ 'feature / flexible-form-field'に対してプルリクエストが行われました。
スターテス:
私はいくつかの助けが必要です:
tnx
(「genenenenaam」としてスラックチャネルにいます)
@rhukster
「リストアイテムの並べ替え」とフィールドテンプレートの名前「list.html.twig」に依存関係はありますか?
私はテストをしました、そしてそれは思われます:
これに対する答えは、新機能の現在の状態に関する私の問題を解決できると思います。