You are here

public static function PatternSettingTypeBase::formGroupProcess in UI Patterns Settings 8.2

Set the right group before drupal #group attribute is processed.

Parameters

array $element: The form field.

\Drupal\Core\Form\FormStateInterface $form_state: The pattern definition.

mixed $form: The form.

Return value

array The processed element.

File

src/Plugin/PatternSettingTypeBase.php, line 380

Class

PatternSettingTypeBase
Base class for UI Patterns Setting plugins.

Namespace

Drupal\ui_patterns_settings\Plugin

Code

public static function formGroupProcess(array &$element, FormStateInterface $form_state = NULL, &$form = []) {
  if (isset($element['#pattern_setting_definition'])) {
    $setting_definition = $element['#pattern_setting_definition'];
    if ($setting_definition
      ->getGroup() !== NULL) {
      $parents = $element['#parents'];
      array_pop($parents);
      $parents[] = $setting_definition
        ->getGroup();
      $element['#group'] = implode('][', $parents);
    }
  }
  return $element;
}