function Get::transform

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

Overrides ProcessPluginBase::transform

File

core/modules/migrate/src/Plugin/migrate/process/Get.php, line 107

Class

Get
Gets the source value.

Namespace

Drupal\migrate\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    $source = $this->configuration['source'];
    $properties = is_string($source) ? [
        $source,
    ] : $source;
    $return = [];
    foreach ($properties as $property) {
        if ($property || (string) $property === '0') {
            $return[] = $row->get($property);
        }
        else {
            $return[] = $value;
        }
    }
    if (is_string($source)) {
        $this->multiple = is_array($return[0]);
        return $return[0];
    }
    return $return;
}

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