Tabs.php in Field Group: Easy Responsive Tabs to Accordion 8
File
src/Element/Tabs.php
View source
<?php
namespace Drupal\field_group_easy_responsive_tabs\Element;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element\RenderElement;
class Tabs extends RenderElement {
public function getInfo() {
$class = get_class($this);
return [
'#type' => 'field_group_easy_responsive_tabs',
'#theme_wrappers' => [
'field_group_easy_responsive_tabs',
],
'#process' => [
[
$class,
'processTabs',
],
],
];
}
public static function processTabs(&$element, FormStateInterface $form_state, $on_form = TRUE) {
$element['group'] = [
'#type' => 'details',
'#theme_wrappers' => [],
'#parents' => $element['#parents'],
];
if (!isset($element['#title'])) {
$element['#title'] = t('Tabs');
$element['#title_display'] = 'invisible';
}
return $element;
}
}
Classes
Name |
Description |
Tabs |
Provides a render element for tabs. |