You are here

protected function DateRecurModularWidgetFieldsTrait::getFieldTimeZone in Recurring Date Field Modular Widgets 8

Same name and namespace in other branches
  1. 3.x src/DateRecurModularWidgetFieldsTrait.php \Drupal\date_recur_modular\DateRecurModularWidgetFieldsTrait::getFieldTimeZone()
  2. 2.x src/DateRecurModularWidgetFieldsTrait.php \Drupal\date_recur_modular\DateRecurModularWidgetFieldsTrait::getFieldTimeZone()

Get a time zone element.

Parameters

string|null $timeZone: Optional default time zone for which default value is derived.

Return value

array A render array.

3 calls to DateRecurModularWidgetFieldsTrait::getFieldTimeZone()
DateRecurModularAlphaWidget::formElement in src/Plugin/Field/FieldWidget/DateRecurModularAlphaWidget.php
Returns the form for a single field widget.
DateRecurModularOscarWidget::formElement in src/Plugin/Field/FieldWidget/DateRecurModularOscarWidget.php
Returns the form for a single field widget.
DateRecurModularSierraWidget::formElement in src/Plugin/Field/FieldWidget/DateRecurModularSierraWidget.php
Returns the form for a single field widget.

File

src/DateRecurModularWidgetFieldsTrait.php, line 26

Class

DateRecurModularWidgetFieldsTrait
Trait containing convenience methods for generating whole form fields.

Namespace

Drupal\date_recur_modular

Code

protected function getFieldTimeZone(?string $timeZone) : array {

  // Saved values (should) always have a time zone.
  $zones = $this
    ->getTimeZoneOptions();
  return [
    '#type' => 'select',
    '#title' => $this
      ->t('Time zone'),
    '#default_value' => $timeZone,
    '#options' => $zones,
  ];
}