public function BlockVisibilityGroupedListBuilder::submitForm in Block Visibility Groups 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides BlockListBuilder::submitForm
File
- src/
BlockVisibilityGroupedListBuilder.php, line 171
Class
- BlockVisibilityGroupedListBuilder
- Extends BlockListBuilder to add our elements only show certain blocks.
Namespace
Drupal\block_visibility_groupsCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$show_global = $form_state
->getValue('block_visibility_group_show_global', 1);
$this->state
->set('block_visibility_group_show_global', $show_global);
// Prevent sending an empty value, which would unset all blocks.
if (!empty($form_state
->getValue('blocks'))) {
parent::submitForm($form, $form_state);
}
}