Skip to content
Snippets Groups Projects
Verified Commit cb2e043f authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #315176 by Dave Reid, andypost, franz, sun, Alan D.: Clean-up remains of...

Issue #315176 by Dave Reid, andypost, franz, sun, Alan D.: Clean-up remains of $form['array_filter'] hack with array_filter in book module

(cherry picked from commit 65b6ffc9)
parent 67c0d6b8
No related branches found
No related tags found
9 merge requests!1445Issue #2920039: Views' User Name exposed group filter validation,!1298Issue #3240993: Let layout builder render inline block translations,!774Issue #3174569: Example node template file name is incorrect,!497Issue #2463967: Use .user.ini file for PHP settings,!433Resolve #3163663 "Too many open files",!233Resolve #2693787 "Taxonomy term name",!133Resolve #2666286 "Clean up menuui",!112Resolve #3187004 "Drupaldatetime serialization issue",!53Resolve #3181870: Correct typo "the the" in "core/classList" deprecation message.
......@@ -47,7 +47,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#options' => $types,
'#required' => TRUE,
];
$form['array_filter'] = ['#type' => 'value', '#value' => TRUE];
return parent::buildForm($form, $form_state);
}
......@@ -56,7 +55,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
$child_type = $form_state->getValue('book_child_type');
$child_type = array_filter($form_state->getValue('book_child_type'));
if ($form_state->isValueEmpty(['book_allowed_types', $child_type])) {
$form_state->setErrorByName('book_child_type', $this->t('The content type for the %add-child link must be one of those selected as an allowed book outline type.', ['%add-child' => $this->t('Add child page')]));
}
......@@ -76,7 +75,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('book.settings')
// Remove unchecked types.
->set('allowed_types', $allowed_types)
->set('child_type', $form_state->getValue('book_child_type'))
->set('child_type', array_filter($form_state->getValue('book_child_type')))
->save();
parent::submitForm($form, $form_state);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment