You are here

public function UserUpdate7002::transform in Zircon Profile 8

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

Performs the associated process.

Parameters

mixed $value: The value to be transformed.

\Drupal\migrate\MigrateExecutableInterface $migrate_executable: The migration in which this process is being executed.

\Drupal\migrate\Row $row: The row from the source to process. Normally, just transforming the value is adequate but very rarely you might need to change two columns at the same time or something like that.

string $destination_property: The destination property currently worked on. This is only used together with the $row above.

Return value

string|array The newly transformed value.

Overrides ProcessPluginBase::transform

File

core/modules/user/src/Plugin/migrate/process/d6/UserUpdate7002.php, line 65
Contains \Drupal\user\Plugin\migrate\process\d6\UserUpdate7002.

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