public static function PersianDateHelper::monthNames in Persian Date for Drupal 8 8
Same name and namespace in other branches
- 8.4 src/PersianDateHelper.php \Drupal\persian_date\PersianDateHelper::monthNames()
Returns a translated array of month names.
Parameters
bool $required: (optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.
Return value
array An array of month names.
Overrides DateHelper::monthNames
File
- src/
PersianDateHelper.php, line 65
Class
Namespace
Drupal\persian_dateCode
public static function monthNames($required = FALSE) {
// Force the key to use the correct month value, rather than
// starting with zero.
$monthnames = [
1 => t('فروردین', [], [
'context' => 'Long month name',
]),
2 => t('اردیبهشت', [], [
'context' => 'Long month name',
]),
3 => t('خرداد', [], [
'context' => 'Long month name',
]),
4 => t('تیر', [], [
'context' => 'Long month name',
]),
5 => t('مرداد', [], [
'context' => 'Long month name',
]),
6 => t('شهریور', [], [
'context' => 'Long month name',
]),
7 => t('مهر', [], [
'context' => 'Long month name',
]),
8 => t('آبان', [], [
'context' => 'Long month name',
]),
9 => t('آذر', [], [
'context' => 'Long month name',
]),
10 => t('دی', [], [
'context' => 'Long month name',
]),
11 => t('بهمن', [], [
'context' => 'Long month name',
]),
12 => t('اسفند', [], [
'context' => 'Long month name',
]),
];
$none = [
'' => '',
];
return !$required ? $none + $monthnames : $monthnames;
}