You are here

public static function GroupContentHandlerBase::createInstance in Group 8

Instantiates a new instance of this group content 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.

@todo Replace the definition array with a class-based approach like the one entity types use.

@internal Marked as internal because the plugin definitions will become classes in a future release to further mimic the entity type system. Try to extend the base handlers shipped with this module. If not, you'll need to update your implementations when 2.0 lands.

Parameters

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

string $plugin_id: The ID of the plugin the handler is for. This will contain the derivative ID when present, whereas the definition will contain only the base ID.

array $definition: The group content enabler definition.

Return value

static A new instance of the group content handler.

Overrides GroupContentHandlerInterface::createInstance

2 calls to GroupContentHandlerBase::createInstance()
GroupContentAccessControlHandler::createInstance in src/Plugin/GroupContentAccessControlHandler.php
Instantiates a new instance of this group content handler.
GroupContentPermissionProvider::createInstance in src/Plugin/GroupContentPermissionProvider.php
Instantiates a new instance of this group content handler.
2 methods override GroupContentHandlerBase::createInstance()
GroupContentAccessControlHandler::createInstance in src/Plugin/GroupContentAccessControlHandler.php
Instantiates a new instance of this group content handler.
GroupContentPermissionProvider::createInstance in src/Plugin/GroupContentPermissionProvider.php
Instantiates a new instance of this group content handler.

File

src/Plugin/GroupContentHandlerBase.php, line 52

Class

GroupContentHandlerBase
Provides a base class for group content handlers.

Namespace

Drupal\group\Plugin

Code

public static function createInstance(ContainerInterface $container, $plugin_id, array $definition) {
  return new static($plugin_id, $definition);
}