@@ -146,26 +146,28 @@ public function build(array $configuration, string $prototypeName = null): FormD
146146 $ typeField ->setProperty ('options ' , $ typeFieldOptions );
147147 }
148148
149- $ tags = $ this ->tagRepository ->findBy (['suggestFormOption ' => true ]);
150- if ($ settings ['suggest ' ]['fields ' ]['tag ' ]['enable ' ] && $ tags ->current ()) {
151- /** @var GenericFormElement $tagField */
152- $ tagField = $ sessionInformation ->createElement ('tag ' , 'SingleSelect ' );
153- $ tagField ->setLabel ($ this ->getLocalizedLabel ($ settings ['suggest ' ]['fields ' ]['tag ' ]['label ' ]));
154- $ tagField ->setProperty (
155- 'elementDescription ' ,
156- $ this ->getLocalizedLabel ($ settings ['suggest ' ]['fields ' ]['tag ' ]['description ' ])
157- );
158- $ tagField ->addValidator (GeneralUtility::makeInstance (NotEmptyValidator::class));
159- $ tagFieldOptions = [];
160- foreach ($ tags as $ tag ) {
161- $ tagFieldOptions [$ tag ->getUid ()] = $ tag ->getLabel ();
162- }
163- $ prependOptionLabel = ' ' ;
164- if (!empty ($ settings ['suggest ' ]['fields ' ]['tag ' ]['prependOptionLabel ' ])) {
165- $ prependOptionLabel = $ this ->getLocalizedLabel ($ settings ['suggest ' ]['fields ' ]['tag ' ]['prependOptionLabel ' ]);
149+ if ($ settings ['suggest ' ]['fields ' ]['tag ' ]['enable ' ]) {
150+ $ tags = $ this ->tagRepository ->findBy (['suggestFormOption ' => true ]);
151+ if ($ tags ->current ()) {
152+ /** @var GenericFormElement $tagField */
153+ $ tagField = $ sessionInformation ->createElement ('tag ' , 'SingleSelect ' );
154+ $ tagField ->setLabel ($ this ->getLocalizedLabel ($ settings ['suggest ' ]['fields ' ]['tag ' ]['label ' ]));
155+ $ tagField ->setProperty (
156+ 'elementDescription ' ,
157+ $ this ->getLocalizedLabel ($ settings ['suggest ' ]['fields ' ]['tag ' ]['description ' ])
158+ );
159+ $ tagField ->addValidator (GeneralUtility::makeInstance (NotEmptyValidator::class));
160+ $ tagFieldOptions = [];
161+ foreach ($ tags as $ tag ) {
162+ $ tagFieldOptions [$ tag ->getUid ()] = $ tag ->getLabel ();
163+ }
164+ $ prependOptionLabel = ' ' ;
165+ if (!empty ($ settings ['suggest ' ]['fields ' ]['tag ' ]['prependOptionLabel ' ])) {
166+ $ prependOptionLabel = $ this ->getLocalizedLabel ($ settings ['suggest ' ]['fields ' ]['tag ' ]['prependOptionLabel ' ]);
167+ }
168+ $ tagField ->setProperty ('prependOptionLabel ' , $ prependOptionLabel );
169+ $ tagField ->setProperty ('options ' , $ tagFieldOptions );
166170 }
167- $ tagField ->setProperty ('prependOptionLabel ' , $ prependOptionLabel );
168- $ tagField ->setProperty ('options ' , $ tagFieldOptions );
169171 }
170172
171173 /** @var GenericFormElement $titleField */
0 commit comments