You are here

public static function Accordion::processAccordion in Field Group 8

Same name and namespace in other branches
  1. 8.3 src/Element/Accordion.php \Drupal\field_group\Element\Accordion::processAccordion()

Process the accordion item.

Parameters

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

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

Return value

array The processed element.

1 call to Accordion::processAccordion()
Accordion::preRender in src/Plugin/field_group/FieldGroupFormatter/Accordion.php
Allows the field group formatter to manipulate the field group array and attach the formatters rendering element.

File

src/Element/Accordion.php, line 41

Class

Accordion
Provides a render element for an accordion.

Namespace

Drupal\field_group\Element

Code

public static function processAccordion(&$element, FormStateInterface $form_state) {

  // Add the jQuery UI accordion.
  $element['#attached']['library'][] = 'field_group/formatter.accordion';

  // Add the effect class.
  if (isset($element['#effect'])) {
    if (!isset($element['#attributes']['class'])) {
      $element['#attributes']['class'] = array();
    }
    $element['#attributes']['class'][] = 'effect-' . $element['#effect'];
  }
  return $element;
}