function BlockRegion::transform

Same name in other branches
  1. 9 core/modules/block/src/Plugin/migrate/process/BlockRegion.php \Drupal\block\Plugin\migrate\process\BlockRegion::transform()
  2. 10 core/modules/block/src/Plugin/migrate/process/BlockRegion.php \Drupal\block\Plugin\migrate\process\BlockRegion::transform()
  3. 11.x core/modules/block/src/Plugin/migrate/process/BlockRegion.php \Drupal\block\Plugin\migrate\process\BlockRegion::transform()

Overrides StaticMap::transform

File

core/modules/block/src/Plugin/migrate/process/BlockRegion.php, line 56

Class

BlockRegion
Plugin annotation @MigrateProcessPlugin( id = "block_region" )

Namespace

Drupal\block\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    // Set the destination region, based on the source region and theme as well
    // as the current destination default theme.
    list($source_theme, $destination_theme, $region) = $value;
    // Theme is the same on both source and destination, so ensure that the
    // region exists in the destination theme.
    if (strtolower($source_theme) == strtolower($destination_theme)) {
        if (isset($this->regions[$destination_theme][$region])) {
            return $region;
        }
    }
    // Fall back to static mapping.
    return parent::transform($value, $migrate_executable, $row, $destination_property);
}

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