You are here

public static function YamlFormFlexbox::processContainer in YAML Form 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/YamlFormFlexbox.php, line 18

Class

YamlFormFlexbox
Provides a render element for form flexbox.

Namespace

Drupal\yamlform\Element

Code

public static function processContainer(&$element, FormStateInterface $form_state, &$complete_form) {
  $element = parent::processContainer($element, $form_state, $complete_form);
  $element['#attributes']['class'][] = 'yamlform-flexbox';
  $element['#attributes']['class'][] = 'js-yamlform-flexbox';
  if (isset($element['#align_items'])) {
    $element['#attributes']['class'][] = 'yamlform-flexbox--' . $element['#align_items'];
  }
  $element['#attached']['library'][] = 'yamlform/yamlform.element.flexbox';
  return $element;
}