function MoveBlockForm::getSelectedRegion

Same name in other branches
  1. 8.9.x core/modules/layout_builder/src/Form/MoveBlockForm.php \Drupal\layout_builder\Form\MoveBlockForm::getSelectedRegion()
  2. 10 core/modules/layout_builder/src/Form/MoveBlockForm.php \Drupal\layout_builder\Form\MoveBlockForm::getSelectedRegion()
  3. 11.x core/modules/layout_builder/src/Form/MoveBlockForm.php \Drupal\layout_builder\Form\MoveBlockForm::getSelectedRegion()

Gets the selected region.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Return value

string The current region name.

2 calls to MoveBlockForm::getSelectedRegion()
MoveBlockForm::buildForm in core/modules/layout_builder/src/Form/MoveBlockForm.php
Builds the move block form.
MoveBlockForm::submitForm in core/modules/layout_builder/src/Form/MoveBlockForm.php
Form submission handler.

File

core/modules/layout_builder/src/Form/MoveBlockForm.php, line 297

Class

MoveBlockForm
Provides a form for moving a block.

Namespace

Drupal\layout_builder\Form

Code

protected function getSelectedRegion(FormStateInterface $form_state) {
    if ($form_state->hasValue('region')) {
        return explode(':', $form_state->getValue('region'), 2)[1];
    }
    return $this->region;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.