Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ProcessField.php

function 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) {
        return NULL;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal