You are here

protected function ManageComponentAttributesForm::getSelectedDelta in Layout Builder Component Attributes 1.1.x

Same name and namespace in other branches
  1. 1.2.x src/Form/ManageComponentAttributesForm.php \Drupal\layout_builder_component_attributes\Form\ManageComponentAttributesForm::getSelectedDelta()
  2. 1.0.x src/Form/ManageComponentAttributesForm.php \Drupal\layout_builder_component_attributes\Form\ManageComponentAttributesForm::getSelectedDelta()

Gets the selected delta.

Parameters

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

Return value

int The section delta.

1 call to ManageComponentAttributesForm::getSelectedDelta()
ManageComponentAttributesForm::submitForm in src/Form/ManageComponentAttributesForm.php
Form submission handler.

File

src/Form/ManageComponentAttributesForm.php, line 457

Class

ManageComponentAttributesForm
Provides a form for managing block attributes.

Namespace

Drupal\layout_builder_component_attributes\Form

Code

protected function getSelectedDelta(FormStateInterface $form_state) {
  if ($form_state
    ->hasValue('region')) {
    return (int) explode(':', $form_state
      ->getValue('region'))[0];
  }
  return (int) $this->delta;
}