public function Tabs::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 Tabs::process()
- Tabs::preRender in src/
Plugin/ field_group/ FieldGroupFormatter/ Tabs.php - Allows the field group formatter to manipulate the field group array and attach the formatters rendering element.
File
- src/
Plugin/ field_group/ FieldGroupFormatter/ Tabs.php, line 29
Class
- Tabs
- Plugin implementation of the 'horizontal_tabs' 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 += [
'#prefix' => '<div class=" ' . implode(' ', $this
->getClasses()) . '">',
'#suffix' => '</div>',
'#tree' => TRUE,
'#parents' => [
$this->group->group_name,
],
'#default_tab' => '',
];
if ($this
->getSetting('id')) {
$element['#id'] = Html::getUniqueId($this
->getSetting('id'));
}
// By default tabs don't have titles but you can override it in the theme.
if ($this
->getLabel()) {
$element['#title'] = $this
->getLabel();
}
$element += [
'#type' => $this
->getSetting('direction') . '_tabs',
'#theme_wrappers' => [
$this
->getSetting('direction') . '_tabs',
],
];
// Add auto-disable breakpoint.
if ($width_breakpoint = $this
->getSetting('width_breakpoint')) {
$element['#attached']['drupalSettings']['widthBreakpoint'] = $width_breakpoint;
}
}