You are here

interface GroupContentEnablerManagerInterface in Group 8

Provides a common interface for group content enabler managers.

Hierarchy

Expanded class hierarchy of GroupContentEnablerManagerInterface

All classes that implement GroupContentEnablerManagerInterface

14 files declare their use of GroupContentEnablerManagerInterface
ConfigSubscriber.php in src/EventSubscriber/ConfigSubscriber.php
EntityQueryAlter.php in src/QueryAccess/EntityQueryAlter.php
GroupContentAccessControlHandlerTest.php in tests/src/Unit/GroupContentAccessControlHandlerTest.php
GroupContentEntityAccessControlHandlerTest.php in tests/src/Unit/GroupContentEntityAccessControlHandlerTest.php
GroupContentToEntity.php in src/Plugin/views/relationship/GroupContentToEntity.php

... See full list

File

src/Plugin/GroupContentEnablerManagerInterface.php, line 13

Namespace

Drupal\group\Plugin
View source
interface GroupContentEnablerManagerInterface extends PluginManagerInterface, CachedDiscoveryInterface {

  /**
   * Checks whether a certain plugin has a certain handler.
   *
   * @param string $plugin_id
   *   The plugin ID for this handler.
   * @param string $handler_type
   *   The name of the handler.
   *
   * @return bool
   *   Returns TRUE if the plugin has the handler, else FALSE.
   */
  public function hasHandler($plugin_id, $handler_type);

  /**
   * 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.
   *
   * @param string $plugin_id
   *   The plugin ID for this handler.
   * @param string $handler_type
   *   The handler type to create an instance for.
   *
   * @return object
   *   A handler instance.
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   */
  public function getHandler($plugin_id, $handler_type);

  /**
   * Creates new handler instance.
   *
   * \Drupal\group\Plugin\GroupContentEnablerManagerInterface::getHandler() is
   * preferred since that method has additional checking that the class exists
   * and has static caches.
   *
   * @param mixed $class
   *   The handler class to instantiate.
   * @param string $plugin_id
   *   The ID of the plugin the handler is for.
   * @param array $definition
   *   The plugin definition.
   *
   * @return object
   *   A handler instance.
   *
   * @internal
   *   Marked as internal because the plugin definitions will become classes in
   *   a future release to further mimic the entity type system. Do not call
   *   this directly.
   */
  public function createHandlerInstance($class, $plugin_id, array $definition = NULL);

  /**
   * Creates a new access control handler instance.
   *
   * @param string $plugin_id
   *   The plugin ID for this access control handler.
   *
   * @return \Drupal\group\plugin\GroupContentAccessControlHandlerInterface
   *   An access control handler instance.
   *
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   *   Thrown if the plugin doesn't exist.
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   *   Thrown if the access control handler couldn't be loaded.
   */
  public function getAccessControlHandler($plugin_id);

  /**
   * Creates a new permission provider instance.
   *
   * @param string $plugin_id
   *   The plugin ID for this permission provider.
   *
   * @return \Drupal\group\plugin\GroupContentPermissionProviderInterface
   *   A permission provider instance.
   *
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   *   Thrown if the plugin doesn't exist.
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   *   Thrown if the permission provider couldn't be loaded.
   */
  public function getPermissionProvider($plugin_id);

  /**
   * Returns a plugin collection of all available content enablers.
   *
   * This collection will not have anything set in the individual plugins'
   * configuration. Do not use any methods on the plugin that require a group
   * type to be set or you may encounter unexpected behavior. Instead, use
   * ::getInstalled() while providing a group type argument to get fully
   * configured instances of the plugins.
   *
   * @return \Drupal\group\Plugin\GroupContentEnablerCollection
   *   A plugin collection with a vanilla instance of every known plugin.
   */
  public function getAll();

  /**
   * Returns a plugin collection of all installed content enablers.
   *
   * Warning: When called without a $group_type argument, this will return a
   * collection of vanilla plugin instances. See ::getAll() for details about
   * vanilla instances.
   *
   * @param \Drupal\group\Entity\GroupTypeInterface $group_type
   *   (optional) The group type to retrieve installed plugin for.
   *
   * @return \Drupal\group\Plugin\GroupContentEnablerCollection
   *   A plugin collection with a vanilla instance of every installed plugin. If
   *   $group_type was provided, the collection will contain fully instantiated
   *   plugins for the provided group type.
   */
  public function getInstalled(GroupTypeInterface $group_type = NULL);

  /**
   * Returns the plugin ID of all content enablers in use.
   *
   * @param \Drupal\group\Entity\GroupTypeInterface $group_type
   *   (optional) The group type to retrieve plugin IDs for.
   *
   * @return string[]
   *   A list of all installed content enabler plugin IDs. If $group_type was
   *   provided, this will only return the installed IDs for that group type.
   */
  public function getInstalledIds(GroupTypeInterface $group_type = NULL);

  /**
   * Returns the ID of all plugins that define access for a given entity type.
   *
   * @param string $entity_type_id
   *   The entity type ID.
   *
   * @return string[]
   *   The plugin IDs.
   */
  public function getPluginIdsByEntityTypeAccess($entity_type_id);

  /**
   * Installs all plugins which are marked as enforced.
   *
   * @param \Drupal\group\Entity\GroupTypeInterface $group_type
   *   (optional) The group type to install enforced plugins on. Leave blank to
   *   run the installation process for all group types.
   */
  public function installEnforced(GroupTypeInterface $group_type = NULL);

  /**
   * Retrieves all of the group content type IDs for a content plugin.
   *
   * @param string $plugin_id
   *   The ID of the plugin to retrieve group content type IDs for.
   *
   * @return string[]
   *   An array of group content type IDs.
   */
  public function getGroupContentTypeIds($plugin_id);

  /**
   * Retrieves a list of group content type IDs per plugin ID.
   *
   * @return array
   *   An array of group content type ID arrays, keyed by plugin ID.
   */
  public function getPluginGroupContentTypeMap();

  /**
   * Retrieves a list of plugin IDs per group type ID.
   *
   * @return array
   *   An array of content plugin ID arrays, keyed by group type ID.
   */
  public function getGroupTypePluginMap();

  /**
   * Clears the static per group type plugin collection cache.
   *
   * @param \Drupal\group\Entity\GroupTypeInterface $group_type
   *   (optional) The group type to clear the cache for. Leave blank to clear
   *   the cache for all group types.
   */
  public function clearCachedGroupTypeCollections(GroupTypeInterface $group_type = NULL);

  /**
   * Clears static and persistent plugin ID map caches.
   */
  public function clearCachedPluginMaps();

}

Members

Namesort descending Modifiers Type Description Overrides
CachedDiscoveryInterface::clearCachedDefinitions public function Clears static and persistent plugin definition caches. 2
CachedDiscoveryInterface::useCaches public function Disable the use of caches. 2
DiscoveryInterface::getDefinition public function Gets a specific plugin definition. 4
DiscoveryInterface::getDefinitions public function Gets the definition of all plugins for this type. 3
DiscoveryInterface::hasDefinition public function Indicates if a specific plugin definition exists. 2
FactoryInterface::createInstance public function Creates a pre-configured instance of a plugin. 7
GroupContentEnablerManagerInterface::clearCachedGroupTypeCollections public function Clears the static per group type plugin collection cache. 1
GroupContentEnablerManagerInterface::clearCachedPluginMaps public function Clears static and persistent plugin ID map caches. 1
GroupContentEnablerManagerInterface::createHandlerInstance public function Creates new handler instance. 1
GroupContentEnablerManagerInterface::getAccessControlHandler public function Creates a new access control handler instance. 1
GroupContentEnablerManagerInterface::getAll public function Returns a plugin collection of all available content enablers. 1
GroupContentEnablerManagerInterface::getGroupContentTypeIds public function Retrieves all of the group content type IDs for a content plugin. 1
GroupContentEnablerManagerInterface::getGroupTypePluginMap public function Retrieves a list of plugin IDs per group type ID. 1
GroupContentEnablerManagerInterface::getHandler public function Returns a handler instance for the given plugin and handler. 1
GroupContentEnablerManagerInterface::getInstalled public function Returns a plugin collection of all installed content enablers. 1
GroupContentEnablerManagerInterface::getInstalledIds public function Returns the plugin ID of all content enablers in use. 1
GroupContentEnablerManagerInterface::getPermissionProvider public function Creates a new permission provider instance. 1
GroupContentEnablerManagerInterface::getPluginGroupContentTypeMap public function Retrieves a list of group content type IDs per plugin ID. 1
GroupContentEnablerManagerInterface::getPluginIdsByEntityTypeAccess public function Returns the ID of all plugins that define access for a given entity type. 1
GroupContentEnablerManagerInterface::hasHandler public function Checks whether a certain plugin has a certain handler. 1
GroupContentEnablerManagerInterface::installEnforced public function Installs all plugins which are marked as enforced. 1
MapperInterface::getInstance public function Gets a preconfigured instance of a plugin. 4