ImportProcessorPluginManager.php in Entity Share 8.3
File
modules/entity_share_client/src/ImportProcessor/ImportProcessorPluginManager.php
View source
<?php
declare (strict_types=1);
namespace Drupal\entity_share_client\ImportProcessor;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\StringTranslation\StringTranslationTrait;
class ImportProcessorPluginManager extends DefaultPluginManager {
use StringTranslationTrait;
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
$subdir = 'Plugin/EntityShareClient/Processor';
$plugin_interface = 'Drupal\\entity_share_client\\ImportProcessor\\ImportProcessorInterface';
$plugin_definition_annotation_name = 'Drupal\\entity_share_client\\Annotation\\ImportProcessor';
parent::__construct($subdir, $namespaces, $module_handler, $plugin_interface, $plugin_definition_annotation_name);
$this
->alterInfo('entity_share_client_import_processor_info');
$this
->setCacheBackend($cache_backend, 'entity_share_client_import_processors');
}
public function getProcessingStages() {
return [
ImportProcessorInterface::STAGE_PREPARE_ENTITY_DATA => [
'label' => $this
->t('Prepare entity data'),
],
ImportProcessorInterface::STAGE_IS_ENTITY_IMPORTABLE => [
'label' => $this
->t('Is entity importable'),
],
ImportProcessorInterface::STAGE_PREPARE_IMPORTABLE_ENTITY_DATA => [
'label' => $this
->t('Prepare importable entity data'),
],
ImportProcessorInterface::STAGE_PROCESS_ENTITY => [
'label' => $this
->t('Process entity'),
],
ImportProcessorInterface::STAGE_POST_ENTITY_SAVE => [
'label' => $this
->t('Post entity save'),
],
];
}
public function createInstance($plugin_id, array $configuration = []) {
$instance = parent::createInstance($plugin_id);
$instance
->setConfiguration($configuration);
return $instance;
}
}