You are here

public function GroupRelationManager::getHandler in Group 2.0.x

Returns a handler instance for the given plugin and handler.

Entity handlers are instantiated once per entity type and then cached in the entity type manager, and so subsequent calls to getHandler() for a particular entity type and handler type will return the same object. This means that properties on a handler may be used as a static cache, although as the handler is common to all entities of the same type, any data that is per-entity should be keyed by the entity ID.

Parameters

string $plugin_id: The plugin ID for this handler.

string $handler_type: The handler type to create an instance for.

Return value

object A handler instance.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

Overrides GroupRelationManagerInterface::getHandler

3 calls to GroupRelationManager::getHandler()
GroupRelationManager::getAccessControlHandler in src/Plugin/Group/Relation/GroupRelationManager.php
Creates a new access control handler instance.
GroupRelationManager::getPermissionProvider in src/Plugin/Group/Relation/GroupRelationManager.php
Creates a new permission provider instance.
GroupRelationManager::getPostInstallHandler in src/Plugin/Group/Relation/GroupRelationManager.php
Creates a new post install handler instance.

File

src/Plugin/Group/Relation/GroupRelationManager.php, line 123

Class

GroupRelationManager
Manages GroupRelation plugin implementations.

Namespace

Drupal\group\Plugin\Group\Relation

Code

public function getHandler($plugin_id, $handler_type) {
  if (!isset($this->handlers[$handler_type][$plugin_id])) {
    $this->handlers[$handler_type][$plugin_id] = $this
      ->createHandlerInstance($plugin_id, $handler_type);
  }
  return $this->handlers[$handler_type][$plugin_id];
}