You are here

public static function VerticalTabs::processGroup in Field Group 8.3

Arranges elements into groups.

This method is useful for non-input elements that can be used in and outside the context of a form.

Parameters

array $element: An associative array containing the properties and children of the element. Note that $element must be taken by reference here, so processed child elements are taken over into $form_state.

\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.

File

src/Element/VerticalTabs.php, line 84

Class

VerticalTabs
Provides extra processing and pre rendering on the vertical tabs.

Namespace

Drupal\field_group\Element

Code

public static function processGroup(&$element, FormStateInterface $form_state, &$complete_form) {
  $groups =& $form_state
    ->getGroups();
  $element['#groups'] =& $groups;
  if (isset($element['#group'])) {

    // Add this element to the defined group (by reference).
    $group = $element['#group'];
    $groups[$group][] =& $element;
  }
  return $element;
}