public static function YamlFormMultiple::buildElementHeader in YAML Form 8
Build a single element header.
Parameters
array $element: The element.
Return value
array A render array containing inputs for an element's header.
1 call to YamlFormMultiple::buildElementHeader()
- YamlFormMultiple::processYamlFormMultiple in src/
Element/ YamlFormMultiple.php - Process items and build multiple elements widget.
File
- src/
Element/ YamlFormMultiple.php, line 178
Class
- YamlFormMultiple
- Provides a form element to assist in creation of multiple elements.
Namespace
Drupal\yamlform\ElementCode
public static function buildElementHeader(array $element) {
if (empty($element['#header'])) {
return [
[
'data' => '',
'colspan' => 4,
],
];
}
if (is_array($element['#header'])) {
return $element['#header'];
}
$header = [];
$header['_handle_'] = '';
if ($element['#child_keys']) {
foreach ($element['#child_keys'] as $child_key) {
$header[$child_key] = !empty($element['#element'][$child_key]['#title']) ? $element['#element'][$child_key]['#title'] : '';
}
}
else {
$header['item'] = isset($element['#element']['#title']) ? $element['#element']['#title'] : '';
}
$header['weight'] = t('Weight');
if (empty($element['#cardinality'])) {
$header['_operations_'] = '';
}
return $header;
}