protected function FieldGroupTable::getElementTitleData in Field Group Table 8
Return title of a requested element.
Parameters
array $element: Element definition.
int $lvl: Current depth.
Return value
array Title and Required status of a requested element.
2 calls to FieldGroupTable::getElementTitleData()
- FieldGroupTable::buildRowForm in src/
Plugin/ field_group/ FieldGroupFormatter/ FieldGroupTable.php - Build table row for a "form" context.
- FieldGroupTable::buildRowView in src/
Plugin/ field_group/ FieldGroupFormatter/ FieldGroupTable.php - Build table row for a "view" context.
File
- src/
Plugin/ field_group/ FieldGroupFormatter/ FieldGroupTable.php, line 618
Class
- FieldGroupTable
- Plugin implementation of the 'field_group_table' formatter.
Namespace
Drupal\field_group_table\Plugin\field_group\FieldGroupFormatterCode
protected function getElementTitleData(array $element, $lvl = 0) {
$title = isset($element['#title']) ? $element['#title'] : '';
$required = isset($element['#required']) ? $element['#required'] : FALSE;
if (!$title && $lvl < 9) {
$children = Element::children($element);
$lvl++;
foreach ($children as $child) {
if ($result = $this
->getElementTitleData($element[$child], $lvl)) {
return $result;
}
}
}
return [
'title' => $title,
'required' => $required,
];
}