function date_week_days_abbr in Date 7
Same name and namespace in other branches
- 5.2 date_api.module \date_week_days_abbr()
- 6.2 date_api.module \date_week_days_abbr()
- 6 date_api.module \date_week_days_abbr()
- 7.3 date_api/date_api.module \date_week_days_abbr()
- 7.2 date_api/date_api.module \date_week_days_abbr()
An translated array of week day abbreviations.
Parameters
$required: If not required, will include a blank value at the beginning of the array.
Return value
an array of week day abbreviations
3 calls to date_week_days_abbr()
- DateAPITestCase::testDateAPI in tests/
date_api.test - date_day_of_week_name in date_api/
date_api.module - Returns translated name of the day of week for a given date.
- date_popup_process_date in date_popup/
date_popup.module - Process the date portion of the element.
File
- date_api/
date_api.module, line 838 - This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.
Code
function date_week_days_abbr($required = FALSE, $refresh = TRUE, $length = 3) {
$weekdays = array();
switch ($length) {
case 1:
$context = 'day_abbr1';
break;
case 2:
$context = 'day_abbr2';
break;
default:
$context = 'day_abbr';
break;
}
foreach (date_week_days_untranslated() as $key => $day) {
$weekdays[$key] = t(substr($day, 0, $length), array(), array(
'context' => $context,
));
}
$none = array(
'' => '',
);
return !$required ? $none + $weekdays : $weekdays;
}