public static function Tabs::processTabs in Field Group: Easy Responsive Tabs to Accordion 8
Creates a group formatted as tabs.
Parameters
array $element: An associative array containing the properties and children of the details element.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
bool $on_form: Are the tabs rendered on a form or not.
Return value
array The processed element.
File
- src/
Element/ Tabs.php, line 44
Class
- Tabs
- Provides a render element for tabs.
Namespace
Drupal\field_group_easy_responsive_tabs\ElementCode
public static function processTabs(&$element, FormStateInterface $form_state, $on_form = TRUE) {
// Inject a new details as child, so that form_process_details() processes
// this details element like any other details.
$element['group'] = [
'#type' => 'details',
'#theme_wrappers' => [],
'#parents' => $element['#parents'],
];
// Add an invisible label for accessibility.
if (!isset($element['#title'])) {
$element['#title'] = t('Tabs');
$element['#title_display'] = 'invisible';
}
return $element;
}