function ProcessField::transform

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

Overrides ProcessPluginBase::transform

File

core/modules/field/src/Plugin/migrate/process/ProcessField.php, line 94

Class

ProcessField
Get the value from a method call on a field plugin instance.

Namespace

Drupal\field\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    if (!is_string($value)) {
        throw new MigrateException('The input value must be a string.');
    }
    if (empty($this->configuration['method'])) {
        throw new MigrateException('You need to specify the name of a method to be called on the Field plugin.');
    }
    $method = $this->configuration['method'];
    try {
        return $this->callMethodOnFieldPlugin($this->fieldPluginManager, $value, $method, $row);
    } catch (PluginNotFoundException $e) {
        return NULL;
    }
}

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