function _webform_datelist_date_date_callback in Webform 8.5
Same name and namespace in other branches
- 6.x includes/webform.date.inc \_webform_datelist_date_date_callback()
Callback for removing abbreviation from datelist.
Parameters
array $element: The element.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
\Drupal\Core\Datetime\DrupalDateTime|null $date: The date value.
See also
\Drupal\Core\Datetime\Element\Datelist::processDatelist
1 string reference to '_webform_datelist_date_date_callback'
- DateList::prepare in src/
Plugin/ WebformElement/ DateList.php - Prepare an element to be rendered within a webform.
File
- includes/
webform.date.inc, line 24 - Callback functions for date, datetime, and time elements.
Code
function _webform_datelist_date_date_callback(array &$element, FormStateInterface $form_state, $date) {
$no_abbreviate = isset($element['#date_abbreviate']) && $element['#date_abbreviate'] === FALSE;
if ($no_abbreviate && isset($element['month']) && isset($element['month']['#options'])) {
// Load translated date part labels from the appropriate calendar plugin.
$date_helper = new DateHelper();
$element['month']['#options'] = $date_helper
->monthNames($element['#required']);
}
}