You are here

public function Details::process in Field Group 8.3

Allows the field group formatter to manipulate the field group array and attach the formatters elements. The process method is called in the #process part of theme layer, and is currently used for forms. The preRender method is called in the #pre_render part of the theme layer, and is currently used for entity displays.

Parameters

array $element: The field group render array.

object $processed_object: The object / entity beïng processed.

Overrides FieldGroupFormatterBase::process

2 calls to Details::process()
Details::preRender in src/Plugin/field_group/FieldGroupFormatter/Details.php
Allows the field group formatter to manipulate the field group array and attach the formatters rendering element.
DetailsSidebar::process in src/Plugin/field_group/FieldGroupFormatter/DetailsSidebar.php
Allows the field group formatter to manipulate the field group array and attach the formatters elements. The process method is called in the #process part of theme layer, and is currently used for forms. The preRender method is called in the…
1 method overrides Details::process()
DetailsSidebar::process in src/Plugin/field_group/FieldGroupFormatter/DetailsSidebar.php
Allows the field group formatter to manipulate the field group array and attach the formatters elements. The process method is called in the #process part of theme layer, and is currently used for forms. The preRender method is called in the…

File

src/Plugin/field_group/FieldGroupFormatter/Details.php, line 26

Class

Details
Details element.

Namespace

Drupal\field_group\Plugin\field_group\FieldGroupFormatter

Code

public function process(&$element, $processed_object) {
  $element += [
    '#type' => 'details',
    '#title' => $this
      ->getLabel(),
    '#open' => $this
      ->getSetting('open'),
    '#show_empty_fields' => $this
      ->getSetting('show_empty_fields'),
    '#description' => $this
      ->getSetting('description'),
  ];
  if ($this
    ->getSetting('id')) {
    $element['#id'] = Html::getUniqueId($this
      ->getSetting('id'));
  }
  $classes = $this
    ->getClasses();
  if (!empty($classes)) {
    $element += [
      '#attributes' => [
        'class' => $classes,
      ],
    ];
  }
  if ($this
    ->getSetting('required_fields')) {
    $element['#attached']['library'][] = 'field_group/formatter.details';
    $element['#attached']['library'][] = 'field_group/core';
  }
}