public static function DateHelper::weekDaysAbbr in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDaysAbbr()
- 9 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::weekDaysAbbr()
Constructs a translated array of week day abbreviations.
Parameters
bool $required: (optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Return value
array An array of week day abbreviations
File
- core/
lib/ Drupal/ Core/ Datetime/ DateHelper.php, line 185
Class
- DateHelper
- Defines Gregorian Calendar date values.
Namespace
Drupal\Core\DatetimeCode
public static function weekDaysAbbr($required = FALSE) {
$weekdays = [
t('Sun', [], [
'context' => 'Abbreviated weekday',
]),
t('Mon', [], [
'context' => 'Abbreviated weekday',
]),
t('Tue', [], [
'context' => 'Abbreviated weekday',
]),
t('Wed', [], [
'context' => 'Abbreviated weekday',
]),
t('Thu', [], [
'context' => 'Abbreviated weekday',
]),
t('Fri', [], [
'context' => 'Abbreviated weekday',
]),
t('Sat', [], [
'context' => 'Abbreviated weekday',
]),
];
$none = [
'' => '',
];
return !$required ? $none + $weekdays : $weekdays;
}