function ProcessField::callMethodOnFieldPlugin
Same name in other branches
- 8.9.x core/modules/field/src/Plugin/migrate/process/ProcessField.php \Drupal\field\Plugin\migrate\process\ProcessField::callMethodOnFieldPlugin()
- 10 core/modules/field/src/Plugin/migrate/process/ProcessField.php \Drupal\field\Plugin\migrate\process\ProcessField::callMethodOnFieldPlugin()
- 11.x core/modules/field/src/Plugin/migrate/process/ProcessField.php \Drupal\field\Plugin\migrate\process\ProcessField::callMethodOnFieldPlugin()
Instantiate a field plugin and call a method on it.
Parameters
\Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface $field_plugin_manager: The field plugin manager.
string $field_type: The field type for which to get the field plugin.
string $method: The method to call on the field plugin.
\Drupal\migrate\Row $row: The row from the source to process.
Return value
mixed The return value from the method called on the field plugin.
1 call to ProcessField::callMethodOnFieldPlugin()
- ProcessField::transform in core/
modules/ field/ src/ Plugin/ migrate/ process/ ProcessField.php - Performs the associated process.
File
-
core/
modules/ field/ src/ Plugin/ migrate/ process/ ProcessField.php, line 129
Class
- ProcessField
- Get the value from a method call on a field plugin instance.
Namespace
Drupal\field\Plugin\migrate\processCode
protected function callMethodOnFieldPlugin(MigrateFieldPluginManagerInterface $field_plugin_manager, $field_type, $method, Row $row) {
$plugin_id = $field_plugin_manager->getPluginIdFromFieldType($field_type, [], $this->migration);
$plugin_instance = $field_plugin_manager->createInstance($plugin_id, [], $this->migration);
if (!is_callable([
$plugin_instance,
$method,
])) {
throw new MigrateException('The specified method does not exist or is not callable.');
}
return call_user_func_array([
$plugin_instance,
$method,
], [
$row,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.