You are here

public static function PersianDateHelper::weekDaysAbbr in Persian Date for Drupal 8 8.4

Same name and namespace in other branches
  1. 8 src/PersianDateHelper.php \Drupal\persian_date\PersianDateHelper::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

Overrides DateHelper::weekDaysAbbr

1 call to PersianDateHelper::weekDaysAbbr()
PersianDateHelper::dayOfWeekName in src/PersianDateHelper.php
Returns translated name of the day of week for a given date.

File

src/PersianDateHelper.php, line 169

Class

PersianDateHelper

Namespace

Drupal\persian_date

Code

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;
}