You are here

public static function WebformLayoutContainer::processContainer in Webform Layout Container 8

Processes a container element.

Parameters

array $element: An associative array containing the properties and children of the container.

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

array $complete_form: The complete form structure.

Return value

array The processed element.

Overrides Container::processContainer

File

src/Element/WebformLayoutContainer.php, line 18

Class

WebformLayoutContainer
Provides a render element for webform layout container.

Namespace

Drupal\webform_layout_container\Element

Code

public static function processContainer(&$element, FormStateInterface $form_state, &$complete_form) {
  $element = parent::processContainer($element, $form_state, $complete_form);
  $element['#attributes']['class'][] = 'webform-layoutcontainer';
  $element['#attributes']['class'][] = 'js-webform-layoutcontainer';
  if (isset($element['#align'])) {
    $element['#attributes']['class'][] = 'webform-layoutcontainer--' . $element['#align'];
  }
  else {
    $element['#attributes']['class'][] = 'webform-layoutcontainer--equal';
  }
  $element['#attached']['library'][] = 'webform_layout_container/webform.element.layoutcontainer';
  return $element;
}