You are here

public function BootstrapLayoutsBase::submitConfigurationForm in Bootstrap Layouts 8.5

Same name and namespace in other branches
  1. 8.4 src/Plugin/Layout/BootstrapLayoutsBase.php \Drupal\bootstrap_layouts\Plugin\Layout\BootstrapLayoutsBase::submitConfigurationForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides LayoutDefault::submitConfigurationForm

File

src/Plugin/Layout/BootstrapLayoutsBase.php, line 230

Class

BootstrapLayoutsBase
Layout class for all bootstrap layouts.

Namespace

Drupal\bootstrap_layouts\Plugin\Layout

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $defaults = $this
    ->getRegionDefaults();
  if ($layout = $form_state
    ->getValue('layout', $defaults)) {

    // Apply Xss::filter to attributes.
    $layout['attributes'] = Xss::filter($layout['attributes']);
    $this->configuration['layout'] = $layout;
  }
  $regions = [];
  foreach ($this
    ->getPluginDefinition()
    ->getRegionNames() as $name) {
    if ($region = $form_state
      ->getValue($name, $defaults)) {

      // Apply Xss::filter to attributes.
      $region['attributes'] = Xss::filter($region['attributes']);
      $regions[$name] = $region;
    }
  }
  $this->configuration['regions'] = $regions;
}