public function FlowControllerBase::getFieldHandler in CMS Content Sync 2.1.x
Get the correct field handler instance for this entity type and field config.
Parameters
$entity_type_name:
$bundle_name:
$field_name:
Return value
\Drupal\cms_content_sync\Plugin\FieldHandlerInterface
File
- src/
Controller/ FlowControllerBase.php, line 362
Class
Namespace
Drupal\cms_content_sync\ControllerCode
public function getFieldHandler($entity_type_name, $bundle_name, $field_name) {
$fieldPluginManager = \Drupal::service('plugin.manager.cms_content_sync_field_handler');
$config = $this
->getPropertyConfig($entity_type_name, $bundle_name, $field_name);
if (empty($config)) {
return null;
}
if (Flow::HANDLER_IGNORE == $config['handler']) {
return null;
}
$entityFieldManager = \Drupal::service('entity_field.manager');
$field_definition = $entityFieldManager
->getFieldDefinitions($entity_type_name, $bundle_name)[$field_name];
return $fieldPluginManager
->createInstance($config['handler'], [
'entity_type_name' => $entity_type_name,
'bundle_name' => $bundle_name,
'field_name' => $field_name,
'field_definition' => $field_definition,
'settings' => $config,
'sync' => $this->flow,
]);
}