Loading src/Form/SubscribeForm.php +6 −3 Original line number Diff line number Diff line Loading @@ -141,6 +141,9 @@ class SubscribeForm extends FormBase { ], ]; $allowedDemographicData = []; $allowedMailingLists = []; try { $defaultAllowedMailingLists = $this->apsis->getAllowedMailingLists(); $defaultAllowedDemographicData = $this->apsis->getAllowedDemographicData(); Loading Loading @@ -170,7 +173,7 @@ class SubscribeForm extends FormBase { } // Demographics. if (count($allowedDemographicData) > 0) { if (is_countable($allowedDemographicData) && (count($allowedDemographicData) > 0)) { $form['apsis_demographic_data'] = [ '#type' => 'container', '#tree' => TRUE, Loading @@ -188,7 +191,7 @@ class SubscribeForm extends FormBase { } } if (count($allowedMailingLists) > 1) { if (is_countable($allowedMailingLists) && (count($allowedMailingLists) > 1)) { $form['exposed_lists'] = [ '#type' => 'checkboxes', '#title' => $this->t('Mailing lists'), Loading @@ -209,7 +212,7 @@ class SubscribeForm extends FormBase { // If there is only one mailinglist selected, and no explict exposed setting // set, we'll not expose controls to the user. if (empty($build_info['args'][0]) && count($allowedMailingLists) == 1) { if (empty($build_info['args'][0]) && is_countable($allowedMailingLists) && (count($allowedMailingLists) == 1)) { $build_info['args'][0] = key($allowedMailingLists); $form_state->setBuildInfo($build_info); } Loading Loading
src/Form/SubscribeForm.php +6 −3 Original line number Diff line number Diff line Loading @@ -141,6 +141,9 @@ class SubscribeForm extends FormBase { ], ]; $allowedDemographicData = []; $allowedMailingLists = []; try { $defaultAllowedMailingLists = $this->apsis->getAllowedMailingLists(); $defaultAllowedDemographicData = $this->apsis->getAllowedDemographicData(); Loading Loading @@ -170,7 +173,7 @@ class SubscribeForm extends FormBase { } // Demographics. if (count($allowedDemographicData) > 0) { if (is_countable($allowedDemographicData) && (count($allowedDemographicData) > 0)) { $form['apsis_demographic_data'] = [ '#type' => 'container', '#tree' => TRUE, Loading @@ -188,7 +191,7 @@ class SubscribeForm extends FormBase { } } if (count($allowedMailingLists) > 1) { if (is_countable($allowedMailingLists) && (count($allowedMailingLists) > 1)) { $form['exposed_lists'] = [ '#type' => 'checkboxes', '#title' => $this->t('Mailing lists'), Loading @@ -209,7 +212,7 @@ class SubscribeForm extends FormBase { // If there is only one mailinglist selected, and no explict exposed setting // set, we'll not expose controls to the user. if (empty($build_info['args'][0]) && count($allowedMailingLists) == 1) { if (empty($build_info['args'][0]) && is_countable($allowedMailingLists) && (count($allowedMailingLists) == 1)) { $build_info['args'][0] = key($allowedMailingLists); $form_state->setBuildInfo($build_info); } Loading