You are here

public function SmartDateTimezoneWidget::getSiteTimezone in Smart Date 3.3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/SmartDateTimezoneWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateTimezoneWidget::getSiteTimezone()
  2. 3.x src/Plugin/Field/FieldWidget/SmartDateTimezoneWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateTimezoneWidget::getSiteTimezone()
  3. 3.0.x src/Plugin/Field/FieldWidget/SmartDateTimezoneWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateTimezoneWidget::getSiteTimezone()
  4. 3.1.x src/Plugin/Field/FieldWidget/SmartDateTimezoneWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateTimezoneWidget::getSiteTimezone()
  5. 3.2.x src/Plugin/Field/FieldWidget/SmartDateTimezoneWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateTimezoneWidget::getSiteTimezone()
  6. 3.4.x src/Plugin/Field/FieldWidget/SmartDateTimezoneWidget.php \Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateTimezoneWidget::getSiteTimezone()

Helper function to return only the site's timezone.

2 calls to SmartDateTimezoneWidget::getSiteTimezone()
SmartDateTimezoneWidget::formElement in src/Plugin/Field/FieldWidget/SmartDateTimezoneWidget.php
Returns the form for a single field widget.
SmartDateTimezoneWidget::settingsForm in src/Plugin/Field/FieldWidget/SmartDateTimezoneWidget.php
Returns a form to configure settings for the widget.

File

src/Plugin/Field/FieldWidget/SmartDateTimezoneWidget.php, line 207

Class

SmartDateTimezoneWidget
Plugin implementation of the 'smartdate_timezone' widget.

Namespace

Drupal\smart_date\Plugin\Field\FieldWidget

Code

public function getSiteTimezone() {

  // Ignore PHP strict notice if time zone has not yet been set in the php.ini
  // configuration.
  $config = \Drupal::config('system.date');
  $config_data_default_timezone = $config
    ->get('timezone.default');
  return !empty($config_data_default_timezone) ? $config_data_default_timezone : @date_default_timezone_get();
}