You are here

class EntityIndexer in Views Natural Sort 8.2

Provides base functionality for the VNS Entith Index Queue Workers.

Plugin annotation


@QueueWorker(
  id = "views_natural_sort_entity_index",
  title = @Translation("Views Natural Sort Entity Index"),
)

Hierarchy

Expanded class hierarchy of EntityIndexer

File

src/Plugin/QueueWorker/EntityIndexer.php, line 19

Namespace

Drupal\views_natural_sort\Plugin\QueueWorker
View source
class EntityIndexer extends QueueWorkerBase implements ContainerFactoryPluginInterface {
  protected $entityTypeManager;
  public function __construct(EntityTypeManager $entityTypeManager, ViewsNaturalSortService $viewsNaturalSortService) {
    $this->entityTypeManager = $entityTypeManager;
    $this->viewsNaturalSortService = $viewsNaturalSortService;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($container
      ->get('entity_type.manager'), $container
      ->get('views_natural_sort.service'));
  }

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {
    $entity = $this->entityTypeManager
      ->getStorage($data['entity_type'])
      ->load($data['entity_id']);
    if ($entity) {
      $this->viewsNaturalSortService
        ->storeIndexRecordsFromEntity($entity);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityIndexer::$entityTypeManager protected property
EntityIndexer::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
EntityIndexer::processItem public function Works on a single queue item. Overrides QueueWorkerInterface::processItem
EntityIndexer::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.