<?php namespace Drupal\uw_cfg_common\Plugin\Layout; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Layout\LayoutDefault; use Drupal\Core\Plugin\PluginFormInterface; /** * A column layout base. */ class UwColumnLayoutBase extends LayoutDefault implements PluginFormInterface { /** * {@inheritdoc} */ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { // Call parent and let it do its thing (like set the label). parent::submitConfigurationForm($form, $form_state); // Set the column class in the config. $this->configuration['column_class'] = $form_state->getValue( ['column_class'], NULL ); } /** * {@inheritdoc} */ public function build(array $regions) { // Build the render array as usual. $build = parent::build($regions); // Retrieve the config for the layout. $configuration = $this->getConfiguration(); // Set the column class to be used in the layout template. $build['#settings']['column_class'] = $configuration['column_class']; return $build; } }