You are here

public function FormStep::preRender in Simple multi step form 8.x

Same name and namespace in other branches
  1. 8 src/Plugin/field_group/FieldGroupFormatter/FormStep.php \Drupal\simple_multistep\Plugin\field_group\FieldGroupFormatter\FormStep::preRender()

File

src/Plugin/field_group/FieldGroupFormatter/FormStep.php, line 24

Class

FormStep
Plugin implementation of the 'form_step' formatter.

Namespace

Drupal\simple_multistep\Plugin\field_group\FieldGroupFormatter

Code

public function preRender(&$element, $rendering_object) {
  $element += array(
    '#type' => 'container',
    '#pre_render' => array(),
    '#attributes' => array(),
  );
  if ($this
    ->getSetting('id')) {
    $element['#attributes']['id'] = $this
      ->getSetting('id');
  }
  $classes = $this
    ->getClasses();
  if (!empty($classes)) {
    $element['#attributes']['class'] = $classes;
  }
  if ($this
    ->getSetting('required_fields')) {
    $element['#attached']['library'][] = 'field_group/formatter.fieldset';
    $element['#attached']['library'][] = 'field_group/core';
  }
}