function TimeZone::transform

Same name in this branch
  1. 11.x core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php \Drupal\system\Plugin\migrate\process\d6\TimeZone::transform()
Same name and namespace in other branches
  1. 10 core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php \Drupal\system\Plugin\migrate\process\d6\TimeZone::transform()
  2. 9 core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php \Drupal\system\Plugin\migrate\process\d6\TimeZone::transform()
  3. 8.9.x core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php \Drupal\system\Plugin\migrate\process\d6\TimeZone::transform()
  4. main core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php \Drupal\system\Plugin\migrate\process\d6\TimeZone::transform()
  5. main core/modules/migrate/src/Plugin/migrate/process/TimeZone.php \Drupal\migrate\Plugin\migrate\process\TimeZone::transform()

Overrides ProcessPluginBase::transform

File

core/modules/migrate/src/Plugin/migrate/process/TimeZone.php, line 19

Class

TimeZone
Process the Timezone offset into a Drupal compatible timezone name.

Namespace

Drupal\migrate\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
  $offset = $value;
  // Convert the integer value of the offset (which can be either
  // negative or positive) to a timezone name.
  // Note: Daylight saving time is not to be used.
  return timezone_name_from_abbr('', intval($offset), 0) ?: 'UTC';
}

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