public function EntityProcessorPluginManager::getInstanceByEntityType in Content Synchronizer 3.x
Same name and namespace in other branches
- 8.2 src/Processors/Entity/EntityProcessorPluginManager.php \Drupal\content_synchronizer\Processors\Entity\EntityProcessorPluginManager::getInstanceByEntityType()
- 8 src/Processors/Entity/EntityProcessorPluginManager.php \Drupal\content_synchronizer\Processors\Entity\EntityProcessorPluginManager::getInstanceByEntityType()
Get the plugin by bundle type.
Parameters
string $entityType: The entity type id.
Return value
EntityProcessorBase The entity processor base.
File
- src/
Processors/ Entity/ EntityProcessorPluginManager.php, line 49
Class
- EntityProcessorPluginManager
- The entity processor plugin manager.
Namespace
Drupal\content_synchronizer\Processors\EntityCode
public function getInstanceByEntityType($entityType) {
$instance = NULL;
foreach ($this
->getDefinitions() as $pluginId => $definition) {
if ($definition['entityType'] == $entityType) {
$instance = static::createInstance($pluginId, []);
}
}
if (is_null($instance)) {
if (!array_key_exists('default', static::$instances)) {
static::$instances['default'] = new EntityProcessorBase([], 'default', []);
}
$instance = static::$instances['default'];
}
$instance
->setEntityType($entityType);
return $instance;
}