function UserUpdate7002::transform

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

Overrides ProcessPluginBase::transform

File

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.