TimeZone.php
Same filename in this branch
Same filename and directory in other branches
- 11.x core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php
- 10 core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php
- 9 core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php
- 8.9.x core/modules/system/src/Plugin/migrate/process/d6/TimeZone.php
- 11.x core/modules/migrate/src/Plugin/migrate/process/TimeZone.php
Namespace
Drupal\migrate\Plugin\migrate\processFile
-
core/
modules/ migrate/ src/ Plugin/ migrate/ process/ TimeZone.php
View source
<?php
namespace Drupal\migrate\Plugin\migrate\process;
use Drupal\migrate\Attribute\MigrateProcess;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
/**
* Process the Timezone offset into a Drupal compatible timezone name.
*/
class TimeZone extends ProcessPluginBase {
/**
* {@inheritdoc}
*/
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';
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| TimeZone | Process the Timezone offset into a Drupal compatible timezone name. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.