Same name and namespace in other branches
  1. 8.9.x core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php \Drupal\user\Plugin\migrate\process\d6\UserUpdate7002::transform()
  2. 9 core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php \Drupal\user\Plugin\migrate\process\d6\UserUpdate7002::transform()

File

core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php, line 62

Class

UserUpdate7002
Converts user time zones from time zone offsets to time zone names.

Namespace

Drupal\user\Plugin\migrate\process\d6

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
  $timezone = NULL;
  if ($row
    ->hasSourceProperty('timezone_name')) {
    if (isset(static::$timezones[$row
      ->getSourceProperty('timezone_name')])) {
      $timezone = $row
        ->getSourceProperty('timezone_name');
    }
  }
  if (!$timezone && $row
    ->hasSourceProperty('event_timezone')) {
    if (isset(static::$timezones[$row
      ->getSourceProperty('event_timezone')])) {
      $timezone = $row
        ->getSourceProperty('event_timezone');
    }
  }
  if ($timezone === NULL) {
    $timezone = $this->dateConfig
      ->get('timezone.default');
  }
  return $timezone;
}