DiffGeneratorPluginBase.php in Entity Share 8.3
File
modules/entity_share_diff/src/DiffGenerator/DiffGeneratorPluginBase.php
View source
<?php
declare (strict_types=1);
namespace Drupal\entity_share_diff\DiffGenerator;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\entity_share_client\Service\RemoteManagerInterface;
use Drupal\entity_share_diff\Service\EntityParserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class DiffGeneratorPluginBase extends PluginBase implements DiffGeneratorInterface, ContainerFactoryPluginInterface {
use StringTranslationTrait;
protected $remoteManager;
protected $entityTypeManager;
protected $entityParser;
protected $remote;
public function __construct(array $configuration, string $plugin_id, $plugin_definition, RemoteManagerInterface $remoteManager, EntityTypeManagerInterface $entity_type_manager, EntityParserInterface $entity_parser) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->remoteManager = $remoteManager;
$this->entityTypeManager = $entity_type_manager;
$this->entityParser = $entity_parser;
$this->remote = NULL;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('entity_share_client.remote_manager'), $container
->get('entity_type.manager'), $container
->get('entity_share_diff.entity_parser'));
}
public function getRemote() {
return $this->remote;
}
public function setRemote($remote) {
$this->remote = $remote;
}
public static function isApplicable(FieldStorageDefinitionInterface $field_definition) {
return TRUE;
}
}