You are here

public static function GroupContentQueryAccessHandler::createInstance in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Access/GroupContentQueryAccessHandler.php \Drupal\group\Entity\Access\GroupContentQueryAccessHandler::createInstance()

Instantiates a new instance of this entity handler.

This is a factory method that returns a new instance of this object. The factory should pass any needed dependencies into the constructor of this object, but not the container itself. Every call to this method must return a new instance of this object; that is, it may not implement a singleton.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The service container this object should use.

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type definition.

Return value

static A new instance of the entity handler.

Overrides QueryAccessHandlerBase::createInstance

1 call to GroupContentQueryAccessHandler::createInstance()
GroupContentQueryAccessHandlerTest::setUp in tests/src/Kernel/GroupContentQueryAccessHandlerTest.php

File

src/Entity/Access/GroupContentQueryAccessHandler.php, line 35

Class

GroupContentQueryAccessHandler
Controls query access for group_content entities.

Namespace

Drupal\group\Entity\Access

Code

public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) {

  /** @var static $instance */
  $instance = parent::createInstance($container, $entity_type);
  $instance->entityTypeManager = $container
    ->get('entity_type.manager');
  $instance->groupContentEnablerManager = $container
    ->get('plugin.manager.group_content_enabler');
  return $instance;
}