public function UIOverrideProvider::referenceFormTabsRestructure in Bibliography & Citation 2.0.x
Same name and namespace in other branches
- 8 modules/bibcite_entity/src/UIOverrideProvider.php \Drupal\bibcite_entity\UIOverrideProvider::referenceFormTabsRestructure()
Restructure form elements to the vertical tabs view.
Parameters
array $element: Element render array.
File
- modules/
bibcite_entity/ src/ UIOverrideProvider.php, line 124
Class
- UIOverrideProvider
- Collection of hardcoded overrides for reference form and view.
Namespace
Drupal\bibcite_entityCode
public function referenceFormTabsRestructure(array &$element) {
if ($this->config
->get('ui_override.enable_form_override')) {
$field_groups = $this
->getGroupedFields();
// Place tabs under the title.
$weight = $element['title']['#weight'];
$element['tabs'] = [
'#type' => 'vertical_tabs',
'#weight' => ++$weight,
];
foreach ($field_groups as $group_id => $group) {
foreach ($group['elements'] as $field_id) {
if (isset($element[$field_id]) && $element[$field_id]['#access']) {
if (!isset($element[$group_id])) {
$element[$group_id] = [
'#type' => 'details',
'#title' => $group['title'],
'#group' => 'tabs',
];
}
$element[$field_id]['#group'] = $group_id;
}
}
}
}
}