You are here

public function BlockRegion::transform in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/block/src/Plugin/migrate/process/BlockRegion.php \Drupal\block\Plugin\migrate\process\BlockRegion::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 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);
}