diff --git a/recurring_events.tokens.inc b/recurring_events.tokens.inc index 3008e86540817e044c88838d613f0b4ef7b88925..95dcb9350d829c7fa4aabef871585da81b7a2a95 100644 --- a/recurring_events.tokens.inc +++ b/recurring_events.tokens.inc @@ -81,7 +81,7 @@ function recurring_events_tokens($type, $tokens, array $data, array $options, Bu if ($type == 'eventinstance' && !empty($data['eventinstance'])) { $event_instance = $data['eventinstance']; $date_format = \Drupal::config('recurring_events.eventinstance.config')->get('date_format'); - $timezone = new \DateTimeZone(drupal_get_user_timezone()); + $timezone = new \DateTimeZone(date_default_timezone_get()); foreach ($tokens as $name => $original) { switch ($name) { case 'title': diff --git a/src/Entity/EventSeries.php b/src/Entity/EventSeries.php index 25b8567cdb5242c79d78ffdea93a923588b5495e..572f3efcdffe692fb7b912eeff52dfbccb8e6129 100644 --- a/src/Entity/EventSeries.php +++ b/src/Entity/EventSeries.php @@ -618,7 +618,7 @@ class EventSeries extends EditorialContentEntityBase implements EventInterface { * The date object for the consecutive start date. */ public function getConsecutiveStartDate() { - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($this->get('consecutive_recurring_date')->start_date)) { return $this->get('consecutive_recurring_date')->start_date->setTimezone($user_timezone)->setTime(0, 0, 0); } @@ -632,7 +632,7 @@ class EventSeries extends EditorialContentEntityBase implements EventInterface { * The date object for the consecutive end date. */ public function getConsecutiveEndDate() { - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($this->get('consecutive_recurring_date')->end_date)) { return $this->get('consecutive_recurring_date')->end_date->setTimezone($user_timezone)->setTime(0, 0, 0); } @@ -706,7 +706,7 @@ class EventSeries extends EditorialContentEntityBase implements EventInterface { * The date object for the daily start date. */ public function getDailyStartDate() { - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($this->get('daily_recurring_date')->start_date)) { return $this->get('daily_recurring_date')->start_date->setTimezone($user_timezone)->setTime(0, 0, 0); } @@ -720,7 +720,7 @@ class EventSeries extends EditorialContentEntityBase implements EventInterface { * The date object for the daily end date. */ public function getDailyEndDate() { - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($this->get('daily_recurring_date')->end_date)) { return $this->get('daily_recurring_date')->end_date->setTimezone($user_timezone)->setTime(0, 0, 0); } @@ -754,7 +754,7 @@ class EventSeries extends EditorialContentEntityBase implements EventInterface { * The date object for the weekly start date. */ public function getWeeklyStartDate() { - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($this->get('weekly_recurring_date')->start_date)) { return $this->get('weekly_recurring_date')->start_date->setTimezone($user_timezone)->setTime(0, 0, 0); } @@ -768,7 +768,7 @@ class EventSeries extends EditorialContentEntityBase implements EventInterface { * The date object for the weekly end date. */ public function getWeeklyEndDate() { - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($this->get('weekly_recurring_date')->end_date)) { return $this->get('weekly_recurring_date')->end_date->setTimezone($user_timezone)->setTime(0, 0, 0); } @@ -850,7 +850,7 @@ class EventSeries extends EditorialContentEntityBase implements EventInterface { * The date object for the monthly start date. */ public function getMonthlyStartDate() { - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($this->get('monthly_recurring_date')->start_date)) { return $this->get('monthly_recurring_date')->start_date->setTimezone($user_timezone)->setTime(0, 0, 0); } @@ -864,7 +864,7 @@ class EventSeries extends EditorialContentEntityBase implements EventInterface { * The date object for the monthly end date. */ public function getMonthlyEndDate() { - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($this->get('monthly_recurring_date')->end_date)) { return $this->get('monthly_recurring_date')->end_date->setTimezone($user_timezone)->setTime(0, 0, 0); } diff --git a/src/EventCreationService.php b/src/EventCreationService.php index e1bce3d23929a1106c5549a272b36be7fd85a746..992583d8fdae346af023b2aebafe7f166a433db4 100644 --- a/src/EventCreationService.php +++ b/src/EventCreationService.php @@ -174,7 +174,7 @@ class EventCreationService { public function convertFormConfigToArray(FormStateInterface $form_state) { $config = []; - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); $utc_timezone = new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE); $user_input = $form_state->getUserInput(); @@ -381,7 +381,7 @@ class EventCreationService { $form_data = $this->convertEntityConfigToArray($event); $event_instances = []; - $timezone = new \DateTimeZone(drupal_get_user_timezone()); + $timezone = new \DateTimeZone(date_default_timezone_get()); $utc_timezone = new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE); if (!empty($form_data['type'])) { diff --git a/src/EventInstanceListBuilder.php b/src/EventInstanceListBuilder.php index 75a47bada34e90cbcd184d0a291ef07c2817c23d..8d75f8fba0465ecebc81e929eb1b876fb8a9ea52 100644 --- a/src/EventInstanceListBuilder.php +++ b/src/EventInstanceListBuilder.php @@ -122,7 +122,7 @@ class EventInstanceListBuilder extends EntityListBuilder { '#url' => $entity->getEventSeries()->toUrl(), ]; $config = $this->config->get('recurring_events.eventinstance.config'); - $timezone = new \DateTimeZone(drupal_get_user_timezone()); + $timezone = new \DateTimeZone(date_default_timezone_get()); $entity->date->start_date->setTimezone($timezone); $row['date'] = $entity->date->start_date->format($config->get('date_format')); $row['author']['data'] = [ diff --git a/src/EventSeriesListBuilder.php b/src/EventSeriesListBuilder.php index 4aa561fc5b6732cc9b6b6303c3f6447c6c1ce4eb..38ed5f3bf5b0d3d0a8719ba83ccdf7d428bb54ea 100644 --- a/src/EventSeriesListBuilder.php +++ b/src/EventSeriesListBuilder.php @@ -125,7 +125,7 @@ class EventSeriesListBuilder extends EntityListBuilder { $row['type'] = $entity->recur_type->value; $row['instances'] = $entity->getInstanceCount(); $row['starts'] = $this->t('None'); - $timezone = new \DateTimeZone(drupal_get_user_timezone()); + $timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($entity->getSeriesStart())) { $config = $this->config->get('recurring_events.eventseries.config'); $start_date = $entity->getSeriesStart(); diff --git a/src/Form/EventInstanceDeleteForm.php b/src/Form/EventInstanceDeleteForm.php index 33854d614a089d566593b99192492eaa69d49617..9b53f7501146ce542df6555a6b39cd98528dab84 100644 --- a/src/Form/EventInstanceDeleteForm.php +++ b/src/Form/EventInstanceDeleteForm.php @@ -75,7 +75,7 @@ class EventInstanceDeleteForm extends ContentEntityDeleteForm { return $this ->t('Are you sure you want to delete the @language translation of the @entity-type %label?', [ '@language' => $entity->language()->getName(), - '@entity-type' => $this->getEntity()->getEntityType()->getLowercaseLabel(), + '@entity-type' => $this->getEntity()->getEntityType()->getSingularLabel(), '%label' => $this->entity->getEventSeries()->title->value, ]); } diff --git a/src/Form/EventSeriesDeleteForm.php b/src/Form/EventSeriesDeleteForm.php index 131250baf9671822f1285e177107b0cd9077de0e..7ffe9a2fc5d1d840fbf25df33800dd3ec3d4d843 100644 --- a/src/Form/EventSeriesDeleteForm.php +++ b/src/Form/EventSeriesDeleteForm.php @@ -110,7 +110,7 @@ class EventSeriesDeleteForm extends ContentEntityDeleteForm { ]; $options = []; - $timezone = new \DateTimeZone(drupal_get_user_timezone()); + $timezone = new \DateTimeZone(date_default_timezone_get()); foreach ($instances as $instance) { $date = $instance->date->start_date; $date->setTimezone($timezone); diff --git a/src/Plugin/Field/FieldFormatter/EventInstanceDateFormatter.php b/src/Plugin/Field/FieldFormatter/EventInstanceDateFormatter.php index ace9c0f5ef6b89b20e3c5936a1f9d417cfc940c2..0d9d34be7862893ad80317a4ccb6cee140cd2b06 100644 --- a/src/Plugin/Field/FieldFormatter/EventInstanceDateFormatter.php +++ b/src/Plugin/Field/FieldFormatter/EventInstanceDateFormatter.php @@ -98,7 +98,7 @@ class EventInstanceDateFormatter extends EntityReferenceFormatterBase { foreach ($this->getEntitiesToView($items, $langcode) as $delta => $entity) { $date_string = ''; - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); if (!empty($entity->date->start_date) && !empty($entity->date->end_date)) { /** @var \Drupal\Core\Datetime\DrupalDateTime $start_date */ $start_date = $entity->date->start_date; diff --git a/src/Plugin/Field/FieldType/ConsecutiveRecurringDate.php b/src/Plugin/Field/FieldType/ConsecutiveRecurringDate.php index 95bf5ef37fef4352d9115822a365a989eb680595..9b0cd3f0c566d803f99e8855b9d730f6dfc118dd 100644 --- a/src/Plugin/Field/FieldType/ConsecutiveRecurringDate.php +++ b/src/Plugin/Field/FieldType/ConsecutiveRecurringDate.php @@ -137,7 +137,7 @@ class ConsecutiveRecurringDate extends DateRangeItem implements RecurringEventsF public static function convertFormConfigToArray(FormStateInterface $form_state) { $config = []; - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); $utc_timezone = new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE); $user_input = $form_state->getUserInput(); @@ -342,7 +342,7 @@ class ConsecutiveRecurringDate extends DateRangeItem implements RecurringEventsF $count = 0; $max_time = clone $date; - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); $utc_timezone = new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE); $time_parts = static::convertTimeTo24hourFormat($form_data['end_time']); diff --git a/src/Plugin/Field/FieldType/DailyRecurringDate.php b/src/Plugin/Field/FieldType/DailyRecurringDate.php index d59c68d26e3578063eb9b0c5523ef7cbb5ad2f49..66b67277d369c7e5194ab21f462cd640f7517898 100644 --- a/src/Plugin/Field/FieldType/DailyRecurringDate.php +++ b/src/Plugin/Field/FieldType/DailyRecurringDate.php @@ -91,7 +91,7 @@ class DailyRecurringDate extends DateRangeItem implements RecurringEventsFieldTy public static function convertFormConfigToArray(FormStateInterface $form_state) { $config = []; - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); $utc_timezone = new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE); $user_input = $form_state->getUserInput(); diff --git a/src/Plugin/Field/FieldType/MonthlyRecurringDate.php b/src/Plugin/Field/FieldType/MonthlyRecurringDate.php index 21154441d854ea4004f803fec47f6d7f3363105e..f65e6625a3471b71108a3e883d7c1ddeca9d2817 100644 --- a/src/Plugin/Field/FieldType/MonthlyRecurringDate.php +++ b/src/Plugin/Field/FieldType/MonthlyRecurringDate.php @@ -115,7 +115,7 @@ class MonthlyRecurringDate extends WeeklyRecurringDate implements RecurringEvent public static function convertFormConfigToArray(FormStateInterface $form_state) { $config = []; - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); $utc_timezone = new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE); $user_input = $form_state->getUserInput(); diff --git a/src/Plugin/Field/FieldType/WeeklyRecurringDate.php b/src/Plugin/Field/FieldType/WeeklyRecurringDate.php index 28cc10494a484e40adadc078d957eb98f82df67d..455a10c7337299a2ef2dc372ef797b4bfab9d3ef 100644 --- a/src/Plugin/Field/FieldType/WeeklyRecurringDate.php +++ b/src/Plugin/Field/FieldType/WeeklyRecurringDate.php @@ -80,7 +80,7 @@ class WeeklyRecurringDate extends DailyRecurringDate implements RecurringEventsF public static function convertFormConfigToArray(FormStateInterface $form_state) { $config = []; - $user_timezone = new \DateTimeZone(drupal_get_user_timezone()); + $user_timezone = new \DateTimeZone(date_default_timezone_get()); $utc_timezone = new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE); $user_input = $form_state->getUserInput();