protected static function DateElementBase::getElementTitle in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Datetime/Element/DateElementBase.php \Drupal\Core\Datetime\Element\DateElementBase::getElementTitle()
- 9 core/lib/Drupal/Core/Datetime/Element/DateElementBase.php \Drupal\Core\Datetime\Element\DateElementBase::getElementTitle()
Returns the most relevant title of a datetime element.
Since datetime form elements often consist of combined date and time fields the element title might not be located on the element itself but on the parent container element.
Parameters
array $element: The element being processed.
array $complete_form: The complete form structure.
Return value
string The title.
1 call to DateElementBase::getElementTitle()
- Datelist::validateDatelist in core/
lib/ Drupal/ Core/ Datetime/ Element/ Datelist.php - Validation callback for a datelist element.
File
- core/
lib/ Drupal/ Core/ Datetime/ Element/ DateElementBase.php, line 88
Class
- DateElementBase
- Provides a base class for date elements.
Namespace
Drupal\Core\Datetime\ElementCode
protected static function getElementTitle($element, $complete_form) {
$title = '';
if (!empty($element['#title'])) {
$title = $element['#title'];
}
else {
$parents = $element['#array_parents'];
array_pop($parents);
$parent_element = NestedArray::getValue($complete_form, $parents);
if (!empty($parent_element['#title'])) {
$title = $parent_element['#title'];
}
}
return $title;
}