You are here

public static function OfficeHoursFormatterSchema::defaultSettings in Office Hours 8

From https://schema.org/openingHours : The general opening hours for a business. Opening hours can be specified as a weekly time range, starting with days, then times per day. Multiple days can be listed with commas ',' separating each day. Day or time ranges are specified using a hyphen '-'. Days are specified using the following two-letter combinations: Mo, Tu, We, Th, Fr, Sa, Su. Times are specified using 24:00 time. For example, 3pm is specified as 15:00.

Here is an example: <time itemprop="openingHours" datetime="Tu,Th 16:00-20:00"> Tuesdays and Thursdays 4-8pm </time>. If a business is open 7 days a week, then it can be specified as <time itemprop="openingHours" datetime="Mo-Su"> Monday through Sunday, all day </time>.

Overrides OfficeHoursFormatterBase::defaultSettings

1 call to OfficeHoursFormatterSchema::defaultSettings()
OfficeHoursFormatterSchema::viewElements in src/Plugin/Field/FieldFormatter/OfficeHoursFormatterSchema.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/OfficeHoursFormatterSchema.php, line 42

Class

OfficeHoursFormatterSchema
Plugin implementation of the formatter, from https://schema.org/openingHours.

Namespace

Drupal\office_hours\Plugin\Field\FieldFormatter

Code

public static function defaultSettings() {
  return [
    // The following settings are fixed in the Microdata settings.
    'day_format' => 'two_letter',
    // Mo, Tu, We, Th, Fr, Sa, Su.
    'time_format' => 'H',
    // 24:00 time.
    'separator' => [
      'days' => ', ',
      'grouped_days' => '-',
      'day_hours' => ' ',
      'hours_hours' => '-',
      'more_hours' => ', ',
    ],
    'current_status' => [
      'position' => '',
    ],
  ] + parent::defaultSettings();
}