public function Accordion::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
1 call to Accordion::process()
- 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/
Plugin/ field_group/ FieldGroupFormatter/ Accordion.php, line 28
Class
- Accordion
- Plugin implementation of the 'accordion' formatter.
Namespace
Drupal\field_group\Plugin\field_group\FieldGroupFormatterCode
public function process(&$element, $processed_object) {
// Keep using preRender parent for BC.
parent::preRender($element, $processed_object);
$element += [
'#type' => 'field_group_accordion',
'#effect' => $this
->getSetting('effect'),
];
if ($this
->getSetting('id')) {
$element['#id'] = Html::getUniqueId($this
->getSetting('id'));
}
$classes = $this
->getClasses();
if (!empty($classes)) {
$element += [
'#attributes' => [
'class' => $classes,
],
];
}
}