protected function BlockForm::submitVisibility in Drupal 10
Same name and namespace in other branches
- 8 core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::submitVisibility()
- 9 core/modules/block/src/BlockForm.php \Drupal\block\BlockForm::submitVisibility()
Helper function to independently submit the visibility UI.
Parameters
array $form: A nested array form elements comprising the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
1 call to BlockForm::submitVisibility()
- BlockForm::submitForm in core/
modules/ block/ src/ BlockForm.php - This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
1 method overrides BlockForm::submitVisibility()
- BlockEntitySettingTrayForm::submitVisibility in core/
modules/ settings_tray/ src/ Block/ BlockEntitySettingTrayForm.php - Helper function to independently submit the visibility UI.
File
- core/
modules/ block/ src/ BlockForm.php, line 367
Class
- BlockForm
- Provides form for block instance forms.
Namespace
Drupal\blockCode
protected function submitVisibility(array $form, FormStateInterface $form_state) {
foreach ($form_state
->getValue('visibility') as $condition_id => $values) {
// Allow the condition to submit the form.
$condition = $form_state
->get([
'conditions',
$condition_id,
]);
$condition
->submitConfigurationForm($form['visibility'][$condition_id], SubformState::createForSubform($form['visibility'][$condition_id], $form, $form_state));
$condition_configuration = $condition
->getConfiguration();
// Update the visibility conditions on the block.
$this->entity
->getVisibilityConditions()
->addInstanceId($condition_id, $condition_configuration);
}
}