|
30 | 30 | use ipl\Validator\GreaterThanValidator; |
31 | 31 | use ipl\Web\Common\CsrfCounterMeasure; |
32 | 32 | use ipl\Web\Compat\CompatForm; |
| 33 | +use ipl\Web\FormDecorator\IcingaFormDecorator; |
33 | 34 | use ipl\Web\FormElement\TermInput; |
34 | 35 | use ipl\Web\Url; |
35 | 36 | use LogicException; |
@@ -190,6 +191,8 @@ public function __construct(int $scheduleId, Connection $db) |
190 | 191 | { |
191 | 192 | $this->db = $db; |
192 | 193 | $this->scheduleId = $scheduleId; |
| 194 | + |
| 195 | + $this->applyDefaultElementDecorators(); |
193 | 196 | } |
194 | 197 |
|
195 | 198 | /** |
@@ -1058,8 +1061,9 @@ protected function assemble() |
1058 | 1061 | ] |
1059 | 1062 | ]); |
1060 | 1063 |
|
1061 | | - $options = new FieldsetElement('options'); |
1062 | | - $this->addElement($options); |
| 1064 | + $this->addElement('fieldset', 'options'); |
| 1065 | + /** @var FieldsetElement $options */ |
| 1066 | + $options = $this->getElement('options'); |
1063 | 1067 |
|
1064 | 1068 | if ($mode === '24-7') { |
1065 | 1069 | $firstHandoff = $this->assembleTwentyFourSevenOptions($options); |
@@ -1193,20 +1197,24 @@ function ($value, $validator) use ($earliestHandoff, $firstHandoff, $latestHando |
1193 | 1197 | } |
1194 | 1198 | }; |
1195 | 1199 |
|
1196 | | - $this->addElement( |
1197 | | - (new TermInput('members')) |
1198 | | - ->setIgnored() |
1199 | | - ->setRequired() |
1200 | | - ->setOrdered() |
1201 | | - ->setReadOnly() |
1202 | | - ->setVerticalTermDirection() |
1203 | | - ->setLabel($this->translate('Members')) |
1204 | | - ->setSuggestionUrl($this->suggestionUrl->with(['showCompact' => true, '_disableLayout' => 1])) |
1205 | | - ->on(TermInput::ON_ENRICH, $termValidator) |
1206 | | - ->on(TermInput::ON_ADD, $termValidator) |
1207 | | - ->on(TermInput::ON_SAVE, $termValidator) |
1208 | | - ->on(TermInput::ON_PASTE, $termValidator) |
1209 | | - ); |
| 1200 | + $members = (new TermInput('members')) |
| 1201 | + ->setIgnored() |
| 1202 | + ->setRequired() |
| 1203 | + ->setOrdered() |
| 1204 | + ->setReadOnly() |
| 1205 | + ->setVerticalTermDirection() |
| 1206 | + ->setLabel($this->translate('Members')) |
| 1207 | + ->setSuggestionUrl($this->suggestionUrl->with(['showCompact' => true, '_disableLayout' => 1])) |
| 1208 | + ->on(TermInput::ON_ENRICH, $termValidator) |
| 1209 | + ->on(TermInput::ON_ADD, $termValidator) |
| 1210 | + ->on(TermInput::ON_SAVE, $termValidator) |
| 1211 | + ->on(TermInput::ON_PASTE, $termValidator); |
| 1212 | + $this->addElement($members); |
| 1213 | + |
| 1214 | + // TODO: TermInput is not compatible with the new decorators yet: https://github.com/Icinga/ipl-web/pull/317 |
| 1215 | + $legacyDecorator = new IcingaFormDecorator(); |
| 1216 | + $members->setDefaultElementDecorator($legacyDecorator); |
| 1217 | + $legacyDecorator->decorate($members); |
1210 | 1218 |
|
1211 | 1219 | $this->addElement('submit', 'submit', [ |
1212 | 1220 | 'label' => $this->getSubmitLabel() |
|
0 commit comments