You are here

class AllowedHtmlManager in Markdown 8.2

Markdown Allowed HTML Plugin Manager.

@method \Drupal\markdown\Plugin\Markdown\AllowedHtmlInterface createInstance($plugin_id, array $configuration = []) @method \Drupal\markdown\Annotation\MarkdownAllowedHtml getDefinition($plugin_id, $exception_on_invalid = TRUE) @method \Drupal\markdown\Annotation\MarkdownAllowedHtml|void getDefinitionByClassName($className) @method \Drupal\markdown\Annotation\MarkdownAllowedHtml[] getDefinitions($includeFallback = TRUE) @noinspection PhpUnnecessaryFullyQualifiedNameInspection

Hierarchy

Expanded class hierarchy of AllowedHtmlManager

3 files declare their use of AllowedHtmlManager
FilterHtml.php in src/Util/FilterHtml.php
MarkdownParamConverter.php in src/ParamConverter/MarkdownParamConverter.php
ParserConfigurationForm.php in src/Form/ParserConfigurationForm.php
1 string reference to 'AllowedHtmlManager'
markdown.services.yml in ./markdown.services.yml
markdown.services.yml
1 service uses AllowedHtmlManager
plugin.manager.markdown.allowed_html in ./markdown.services.yml
Drupal\markdown\PluginManager\AllowedHtmlManager

File

src/PluginManager/AllowedHtmlManager.php, line 35

Namespace

Drupal\markdown\PluginManager
View source
class AllowedHtmlManager extends InstallablePluginManager {

  /**
   * The Markdown Extension Plugin Manager service.
   *
   * @var \Drupal\markdown\PluginManager\ExtensionManagerInterface
   */
  protected $extensionManager;

  /**
   * The Filter Plugin Manager service.
   *
   * @var \Drupal\filter\FilterPluginManager
   */
  protected $filterManager;

  /**
   * The Markdown Parser Plugin Manager service.
   *
   * @var \Drupal\markdown\PluginManager\ParserManagerInterface
   */
  protected $parserManager;

  /**
   * The Theme Handler service.
   *
   * @var \Drupal\Core\Extension\ThemeHandlerInterface|string
   */
  protected $themeHandler;

  /**
   * The Theme Manager service.
   *
   * @var \Drupal\Core\Theme\ThemeManagerInterface
   */
  protected $themeManager;

  /**
   * {@inheritdoc}
   */
  public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ConfigFactoryInterface $configFactory, LoggerInterface $logger, ModuleHandlerInterface $module_handler, FilterPluginManager $filterManager, ThemeHandlerInterface $themeHandler, ThemeManagerInterface $themeManager, ParserManagerInterface $parserManager, ExtensionManagerInterface $extensionManager) {

    // Add in theme namespaces.
    // @todo Fix when theme namespaces are properly registered.
    // @see https://www.drupal.org/project/drupal/issues/2941757
    $namespaces = iterator_to_array($namespaces);
    foreach ($themeHandler
      ->listInfo() as $extension) {
      $namespaces['Drupal\\' . $extension
        ->getName()] = [
        DRUPAL_ROOT . '/' . $extension
          ->getPath() . '/src',
      ];
    }
    parent::__construct('Plugin/Markdown', new \ArrayObject($namespaces), $configFactory, $logger, $module_handler, AllowedHtmlInterface::class, MarkdownAllowedHtml::class);
    $this
      ->setCacheBackend($cache_backend, 'markdown_allowed_html_info');
    $this
      ->alterInfo($this->cacheKey);
    $this->filterManager = $filterManager;
    $this->themeHandler = $themeHandler;
    $this->themeManager = $themeManager;
    $this->parserManager = $parserManager;
    $this->extensionManager = $extensionManager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container = NULL) {
    if (!$container) {
      $container = \Drupal::getContainer();
    }
    $instance = new static($container
      ->get('container.namespaces'), $container
      ->get('cache.discovery'), $container
      ->get('config.factory'), $container
      ->get('logger.channel.markdown'), $container
      ->get('module_handler'), $container
      ->get('plugin.manager.filter'), $container
      ->get('theme_handler'), $container
      ->get('theme.manager'), $container
      ->get('plugin.manager.markdown.parser'), $container
      ->get('plugin.manager.markdown.extension'));
    $instance
      ->setContainer($container);
    return $instance;
  }

  /**
   * {@inheritdoc}
   */
  protected function alterDefinitions(&$definitions, $runtime = FALSE) {
    foreach ($definitions as $definition) {
      if ($definition instanceof InstallablePlugin) {
        $this
          ->alterDefinition($definition, $runtime);
      }
    }
    if ($hook = $this->alterHook) {
      if ($runtime) {
        $hook = "_runtime";
      }
      $this->moduleHandler
        ->alter($hook, $definitions);
      $this->themeManager
        ->alter($hook, $definitions);
    }
  }

  /**
   * Retrieves plugins that apply to a parser and active theme.
   *
   * Note: this is primarily for use when actually parsing markdown.
   *
   * @param \Drupal\markdown\Plugin\Markdown\ParserInterface $parser
   *   A markdown parser.
   * @param \Drupal\Core\Theme\ActiveTheme $activeTheme
   *   Optional. The active them. This is used as an indicator when in
   *   "render mode".
   * @param array $definitions
   *   Optional. Specific plugin definitions.
   *
   * @return \Drupal\markdown\Plugin\Markdown\AllowedHtmlInterface[]
   *   Plugins that apply to the $parser.
   */
  public function appliesTo(ParserInterface $parser, ActiveTheme $activeTheme = NULL, array $definitions = NULL) {
    $instances = [];
    foreach ($this
      ->getGroupedDefinitions($definitions) as $group => $groupDefinitions) {

      // Filter group definitions based on enabled status of the parser when
      // an active theme has been provided.
      if ($activeTheme) {
        $groupDefinitions = array_intersect_key($groupDefinitions, array_filter($parser
          ->getAllowedHtmlPlugins()));
      }
      switch ($group) {
        case 'extension':
          $groupDefinitions = $this
            ->getExtensionDefinitions($parser, $groupDefinitions, $activeTheme);
          break;
        case 'filter':
          $filter = $parser instanceof FilterAwareInterface ? $parser
            ->getFilter() : NULL;
          $filterFormat = $filter instanceof FilterFormatAwareInterface ? $filter
            ->getFilterFormat() : NULL;
          $groupDefinitions = $this
            ->getFilterDefinitions($filterFormat, $groupDefinitions, $activeTheme);
          break;
        case 'parser':
          $groupDefinitions = $this
            ->getParserDefinitions($parser, $groupDefinitions, $activeTheme);
          break;
        case 'theme':

          // If an active theme was provided, then filter out the theme
          // based plugins that are supported by the active theme.
          if ($activeTheme) {
            $groupDefinitions = $this
              ->getThemeDefinitions($groupDefinitions, $activeTheme);
          }
          break;
      }
      foreach (array_keys($groupDefinitions) as $plugin_id) {
        try {
          $instances[$plugin_id] = $this
            ->createInstance($plugin_id, [
            'activeTheme' => $activeTheme,
            'parser' => $parser,
          ]);
        } catch (PluginException $e) {

          // Intentionally do nothing.
        }
      }
    }
    return $instances;
  }

  /**
   * {@inheritdoc}
   */
  public function getFallbackPluginId($plugin_id = NULL, array $configuration = []) {
    return $plugin_id;
  }

  /**
   * Retrieves definitions supported by parser extensions.
   *
   * @param \Drupal\markdown\Plugin\Markdown\ParserInterface $parser
   *   A parser.
   * @param array $definitions
   *   Optional. Specific definitions to filter, if not provided then all
   *   plugins with an "extension" type will be filtered.
   * @param \Drupal\Core\Theme\ActiveTheme $activeTheme
   *   Optional. The active them. This is used as an indicator when in
   *   "render mode".
   *
   * @return array
   *   A filtered list of definitions supported by parser extensions.
   */
  public function getExtensionDefinitions(ParserInterface $parser, array $definitions = NULL, ActiveTheme $activeTheme = NULL) {

    // Immediately return if parser isn't extensible.
    if (!$parser instanceof ExtensibleParserInterface) {
      return [];
    }
    $definitions = isset($definitions) ? $definitions : $this
      ->getType('extension');

    // Extension only applies to parser when it's supported by it.
    foreach ($definitions as $plugin_id => $definition) {
      $class = static::normalizeClassName($definition
        ->getClass());
      foreach ($parser
        ->extensionInterfaces() as $interface) {
        if (is_subclass_of($class, static::normalizeClassName($interface))) {
          continue 2;
        }
      }
      unset($definitions[$plugin_id]);
    }
    return $definitions;
  }

  /**
   * Retrieves definitions required by filters.
   *
   * @param \Drupal\filter\Entity\FilterFormat $filterFormat
   *   A filter format.
   * @param array $definitions
   *   Optional. Specific definitions to filter, if not provided then all
   *   plugins with a "filter" type will be filtered.
   * @param \Drupal\Core\Theme\ActiveTheme $activeTheme
   *   Optional. The active them. This is used as an indicator when in
   *   "render mode".
   *
   * @return array
   *   A filtered list of definitions supported by the required filter.
   */
  public function getFilterDefinitions(FilterFormat $filterFormat = NULL, array $definitions = NULL, ActiveTheme $activeTheme = NULL) {

    // Immediately return if no filter format was provided.
    if (!$filterFormat) {
      return [];
    }

    /** @var \Drupal\markdown\Annotation\MarkdownAllowedHtml[] $definitions */
    $definitions = isset($definitions) ? $definitions : $this
      ->getType('filter', $definitions);
    $filters = $filterFormat
      ->filters();
    foreach ($definitions as $plugin_id => $definition) {

      // Remove definitions if:
      // 1. Doesn't have "requiresFilter" set.
      // 2. Filter specified by "requiresFilter" doesn't exist.
      // 3. Filter specified by "requiresFilter" isn't actually being used
      //    (status/enabled) during time of render (ActiveTheme).
      if (!$definition
        ->getRequirementsByType('filter', $plugin_id) || !$filters
        ->has($plugin_id) || $activeTheme && !$filters
        ->get($plugin_id)->status) {
        unset($definitions[$plugin_id]);
      }
    }
    return $definitions;
  }

  /**
   * {@inheritdoc}
   */
  public function getGroupedDefinitions(array $definitions = NULL, $label_key = 'label') {
    $definitions = $this
      ->getSortedDefinitions(isset($definitions) ? $definitions : $this
      ->installedDefinitions(), $label_key);
    $grouped_definitions = [];
    foreach ($definitions as $id => $definition) {
      $grouped_definitions[(string) $definition['type']][$id] = $definition;
    }
    return $grouped_definitions;
  }

  /**
   * Retrieves the definition provided by the parser.
   *
   * @param \Drupal\markdown\Plugin\Markdown\ParserInterface $parser
   *   A parser.
   * @param array $definitions
   *   Optional. Specific definitions to filter, if not provided then all
   *   plugins with an "extension" type will be filtered.
   * @param \Drupal\Core\Theme\ActiveTheme $activeTheme
   *   Optional. The active them. This is used as an indicator when in
   *   "render mode".
   *
   * @return array
   *   A filtered list of definitions provided by the parser.
   */
  public function getParserDefinitions(ParserInterface $parser, array $definitions = NULL, ActiveTheme $activeTheme = NULL) {
    $definitions = isset($definitions) ? $definitions : $this
      ->getType('parser');
    $parserClass = static::normalizeClassName(get_class($parser));
    foreach ($definitions as $plugin_id => $definition) {
      $class = static::normalizeClassName($definition
        ->getClass());
      if ($parserClass !== $class && !is_subclass_of($parser, $class)) {
        unset($definitions[$plugin_id]);
      }
    }
    return $definitions;
  }

  /**
   * {@inheritdoc}
   */
  public function getSortedDefinitions(array $definitions = NULL, $label_key = 'label') {

    // Sort the plugins first by type, then by label.
    $definitions = isset($definitions) ? $definitions : $this
      ->installedDefinitions();
    uasort($definitions, function ($a, $b) use ($label_key) {
      if ($a['type'] != $b['type']) {
        return strnatcasecmp($a['type'], $b['type']);
      }
      return strnatcasecmp($a[$label_key], $b[$label_key]);
    });
    return $definitions;
  }

  /**
   * Retrieves definitions supported by the active theme.
   *
   * @param array $definitions
   *   Optional. Specific definitions to filter, if not provided then all
   *   plugins with a "theme" type will be filtered.
   * @param \Drupal\Core\Theme\ActiveTheme $activeTheme
   *   Optional. The active them. This is used as an indicator when in
   *   "render mode".
   *
   * @return array
   *   A filtered list of definitions supported by the active theme.
   */
  public function getThemeDefinitions(array $definitions = NULL, ActiveTheme $activeTheme = NULL) {
    $definitions = isset($definitions) ? $definitions : $this
      ->getType('theme');

    // Only use definitions found in the active theme or its base theme(s).
    if ($activeTheme) {
      $themeAncestry = array_merge(array_keys($activeTheme
        ->getBaseThemes()), [
        $activeTheme
          ->getName(),
      ]);
      foreach ($definitions as $plugin_id => $definition) {
        if (($provider = $definition
          ->getProvider()) && $this->themeHandler
          ->themeExists($provider) && !in_array($provider, $themeAncestry, TRUE)) {
          unset($definitions[$plugin_id]);
        }
      }
    }
    return $definitions;
  }

  /**
   * Retrieves plugins matching a specific type.
   *
   * @param string $type
   *   The type to retrieve.
   * @param array[]|null $definitions
   *   (optional) The plugin definitions to group. If omitted, all plugin
   *   definitions are used.
   *
   * @return array[]
   *   Keys are type names, and values are arrays of which the keys are
   *   plugin IDs and the values are plugin definitions.
   */
  protected function getType($type, array $definitions = NULL) {
    $grouped_definitions = $this
      ->getGroupedDefinitions($definitions);
    return isset($grouped_definitions[$type]) ? $grouped_definitions[$type] : [];
  }

  /**
   * {@inheritdoc}
   */
  protected function getProviderName($provider) {
    if ($this->moduleHandler
      ->moduleExists($provider)) {
      return $this->moduleHandler
        ->getName($provider);
    }
    if ($this->themeHandler
      ->themeExists($provider)) {
      return $this->themeHandler
        ->getName($provider);
    }
  }

  /**
   * {@inheritdoc}
   */
  protected function alterDefinition(InstallablePlugin $definition, $runtime = FALSE) {

    // Immediately return if not altering the runtime definition.
    if (!$runtime) {
      return;
    }

    /* @var \Drupal\markdown\Annotation\MarkdownAllowedHtml $definition */
    switch ($definition->type) {
      case 'extension':
        if (($extensionRequirement = current($definition
          ->getRequirementsByType('extension'))) && ($extensionDefinition = $this->extensionManager
          ->getDefinition($extensionRequirement
          ->getTypeId()))) {
          $definition
            ->merge($extensionDefinition, [
            'ui',
          ]);
        }
        break;
      case 'filter':
        if (($filterRequirement = current($definition
          ->getRequirementsByType('filter'))) && ($filterDefinition = $this->filterManager
          ->getDefinition($filterRequirement
          ->getTypeId()))) {
          $definition
            ->merge($filterDefinition, [
            'ui',
          ]);
          if (empty($definition->label) && !empty($filterDefinition['title'])) {
            $definition->label = $filterDefinition['title'];
          }
        }
        break;
      case 'parser':
        if (($parserRequirement = current($definition
          ->getRequirementsByType('parser'))) && ($parserDefinition = $this->parserManager
          ->getDefinition($parserRequirement
          ->getTypeId()))) {
          $definition
            ->merge($parserDefinition, [
            'ui',
          ]);
        }
        break;
    }

    // Provide a default label if none was provided.
    if (empty($definition->label)) {

      // Use the provider name if plugin identifier is the same.
      if ($definition->id === $definition->provider) {
        $definition['label'] = $this
          ->getProviderName($definition->provider);
      }
      elseif ($definition->type !== 'extension') {
        $definition['label'] = ucwords(trim(str_replace([
          '_',
          '-',
        ], ' ', $definition->id)));
      }
    }

    // Prefix label with provider (if not the same).
    if (in_array($definition->type, [
      'filter',
      'module',
      'theme',
    ]) && $definition->id !== $definition->provider) {
      $definition['label'] = $this
        ->getProviderName($definition->provider) . ': ' . $definition['label'];
    }
  }

  /**
   * {@inheritdoc}
   */
  public function processDefinition(&$definition, $plugin_id) {
    if (!$definition instanceof MarkdownAllowedHtml || !($class = $definition
      ->getClass()) || $definition->requirementViolations) {
      return;
    }

    // Handle deprecated "requiresFilter" property.
    // @todo Deprecated property, remove before 3.0.0.
    if ($filter = $definition->requiresFilter) {
      if (!$definition
        ->getRequirementsByType('filter', $filter)) {
        $requirement = InstallableRequirement::create();
        $requirement->id = "filter:{$filter}";
        $definition->requirements[] = $requirement;
      }
      unset($definition->requiresFilter);
    }

    // Certain types need to be determined prior to parent method processing.
    if (!isset($definition->type)) {
      $definition->type = 'other';

      // Allow dependencies on filters.
      if ($definition
        ->getRequirementsByType('filter')) {
        $definition->type = 'filter';
      }
      elseif (is_subclass_of($class, ParserInterface::class)) {
        $definition->type = 'parser';
        if ($parserDefinition = $this->parserManager
          ->getDefinitionByClassName($class)) {
          $requirement = InstallableRequirement::create();
          $requirement->id = 'parser:' . $parserDefinition->id;
          $definition->requirements[] = $requirement;
        }
      }
      elseif (is_subclass_of($class, ExtensionInterface::class)) {
        $definition->type = 'extension';
        if ($extensionDefinition = $this->extensionManager
          ->getDefinitionByClassName($class)) {
          $requirement = InstallableRequirement::create();
          $requirement->id = 'extension:' . $extensionDefinition->id;
          $definition->requirements[] = $requirement;
        }
      }
      elseif ($this->moduleHandler
        ->moduleExists($definition->provider)) {
        $definition->type = 'module';
      }
      elseif ($this->themeHandler
        ->themeExists($plugin_id)) {
        $definition->type = 'theme';
      }
    }
    parent::processDefinition($definition, $plugin_id);
  }

  /**
   * {@inheritdoc}
   */
  protected function providerExists($provider) {
    return $this->moduleHandler
      ->moduleExists($provider) || $this->themeHandler
      ->themeExists($provider);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AllowedHtmlManager::$extensionManager protected property The Markdown Extension Plugin Manager service.
AllowedHtmlManager::$filterManager protected property The Filter Plugin Manager service.
AllowedHtmlManager::$parserManager protected property The Markdown Parser Plugin Manager service.
AllowedHtmlManager::$themeHandler protected property The Theme Handler service.
AllowedHtmlManager::$themeManager protected property The Theme Manager service.
AllowedHtmlManager::alterDefinition protected function Allows plugin managers to further alter individual definitions. Overrides InstallablePluginManager::alterDefinition
AllowedHtmlManager::alterDefinitions protected function Invokes the hook to alter the definitions if the alter hook is set. Overrides InstallablePluginManager::alterDefinitions
AllowedHtmlManager::appliesTo public function Retrieves plugins that apply to a parser and active theme.
AllowedHtmlManager::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
AllowedHtmlManager::getExtensionDefinitions public function Retrieves definitions supported by parser extensions.
AllowedHtmlManager::getFallbackPluginId public function Gets a fallback id for a missing plugin. Overrides InstallablePluginManager::getFallbackPluginId
AllowedHtmlManager::getFilterDefinitions public function Retrieves definitions required by filters.
AllowedHtmlManager::getGroupedDefinitions public function
AllowedHtmlManager::getParserDefinitions public function Retrieves the definition provided by the parser.
AllowedHtmlManager::getProviderName protected function
AllowedHtmlManager::getSortedDefinitions public function
AllowedHtmlManager::getThemeDefinitions public function Retrieves definitions supported by the active theme.
AllowedHtmlManager::getType protected function Retrieves plugins matching a specific type.
AllowedHtmlManager::processDefinition public function Performs extra processing on plugin definitions. Overrides InstallablePluginManager::processDefinition
AllowedHtmlManager::providerExists protected function Determines if the provider of a definition exists. Overrides DefaultPluginManager::providerExists
AllowedHtmlManager::__construct public function Creates the discovery object. Overrides InstallablePluginManager::__construct
DefaultPluginManager::$additionalAnnotationNamespaces protected property Additional namespaces the annotation discovery mechanism should scan for annotation definitions.
DefaultPluginManager::$alterHook protected property Name of the alter hook if one should be invoked.
DefaultPluginManager::$cacheKey protected property The cache key.
DefaultPluginManager::$cacheTags protected property An array of cache tags to use for the cached definitions.
DefaultPluginManager::$defaults protected property A set of defaults to be referenced by $this->processDefinition() if additional processing of plugins is necessary or helpful for development purposes. 9
DefaultPluginManager::$moduleHandler protected property The module handler to invoke the alter hook. 1
DefaultPluginManager::$namespaces protected property An object that implements \Traversable which contains the root paths keyed by the corresponding namespace to look for plugin implementations.
DefaultPluginManager::$pluginDefinitionAnnotationName protected property The name of the annotation that contains the plugin definition.
DefaultPluginManager::$pluginInterface protected property The interface each plugin should implement. 1
DefaultPluginManager::$subdir protected property The subdirectory within a namespace to look for plugins, or FALSE if the plugins are in the top level of the namespace.
DefaultPluginManager::alterInfo protected function Sets the alter hook name.
DefaultPluginManager::extractProviderFromDefinition protected function Extracts the provider from a plugin definition.
DefaultPluginManager::fixContextAwareDefinitions private function Fix the definitions of context-aware plugins.
DefaultPluginManager::getDiscovery protected function Gets the plugin discovery. Overrides PluginManagerBase::getDiscovery 12
DefaultPluginManager::getFactory protected function Gets the plugin factory. Overrides PluginManagerBase::getFactory
DefaultPluginManager::useCaches public function Disable the use of caches. Overrides CachedDiscoveryInterface::useCaches 1
DiscoveryCachedTrait::$definitions protected property Cached definitions array. 1
DiscoveryCachedTrait::getDefinition public function Overrides DiscoveryTrait::getDefinition 3
DiscoveryTrait::doGetDefinition protected function Gets a specific plugin definition.
DiscoveryTrait::hasDefinition public function
InstallablePluginManager::$cacheContexts protected property Cache contexts.
InstallablePluginManager::$cacheMaxAge protected property Cache max-age.
InstallablePluginManager::$configFactory protected property The Config Factory service.
InstallablePluginManager::$logger protected property A Logger service.
InstallablePluginManager::$runtimeDefinitions protected static property The cached runtime definitions.
InstallablePluginManager::all public function Retrieves all registered plugins. Overrides InstallablePluginManagerInterface::all
InstallablePluginManager::clearCachedDefinitions public function Clears static and persistent plugin definition caches. Overrides DefaultPluginManager::clearCachedDefinitions
InstallablePluginManager::convertInstalledToLibraries Deprecated protected function Converts plugin definitions using the old "installed" method to libraries.
InstallablePluginManager::createInstance public function Creates a pre-configured instance of a plugin. Overrides PluginManagerBase::createInstance 1
InstallablePluginManager::createObjectRequirement protected function 1
InstallablePluginManager::findDefinitions protected function Finds plugin definitions. Overrides DefaultPluginManager::findDefinitions
InstallablePluginManager::firstInstalledPluginId public function Retrieves the first installed plugin identifier. Overrides InstallablePluginManagerInterface::firstInstalledPluginId
InstallablePluginManager::getCacheContexts public function The cache contexts associated with this object. Overrides DefaultPluginManager::getCacheContexts
InstallablePluginManager::getCachedDefinitions protected function Overrides DefaultPluginManager::getCachedDefinitions
InstallablePluginManager::getCacheKey public function Retrieves the cache key to use. Overrides InstallablePluginManagerInterface::getCacheKey
InstallablePluginManager::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides DefaultPluginManager::getCacheMaxAge
InstallablePluginManager::getCacheTags public function The cache tags associated with this object. Overrides DefaultPluginManager::getCacheTags
InstallablePluginManager::getContainer public function Retrieves the container.
InstallablePluginManager::getDefinitionByClassName public function Retrieves a definition by class name. Overrides InstallablePluginManagerInterface::getDefinitionByClassName
InstallablePluginManager::getDefinitionByLibraryId public function Retrieves a definition by library identifier. Overrides InstallablePluginManagerInterface::getDefinitionByLibraryId
InstallablePluginManager::getDefinitions public function Gets the definition of all plugins for this type. Overrides DefaultPluginManager::getDefinitions
InstallablePluginManager::getRuntimeDefinitions protected function Retrieves the runtime definitions.
InstallablePluginManager::handlePluginNotFound protected function Allows plugin managers to specify custom behavior if a plugin is not found. Overrides PluginManagerBase::handlePluginNotFound
InstallablePluginManager::installed public function Retrieves all installed plugins. Overrides InstallablePluginManagerInterface::installed
InstallablePluginManager::installedDefinitions public function Retrieves installed plugin definitions. Overrides InstallablePluginManagerInterface::installedDefinitions
InstallablePluginManager::processLibraryDefinition protected function Processes the library definition.
InstallablePluginManager::setCacheBackend public function Initialize the cache backend. Overrides DefaultPluginManager::setCacheBackend
InstallablePluginManager::setCachedDefinitions protected function Sets a cache of plugin definitions for the decorated discovery class. Overrides DefaultPluginManager::setCachedDefinitions
InstallablePluginManager::sortDefinitions protected function Sorts a definitions array.
NormalizeTrait::isCallable public static function
NormalizeTrait::isTraversable public static function Indicates whether a value is traversable.
NormalizeTrait::normalizeCallables public static function Normalizes any callables provided so they can be stored in the database.
NormalizeTrait::normalizeClassName public static function Normalizes class names to prevent double escaping.
PluginManagerBase::$discovery protected property The object that discovers plugins managed by this manager.
PluginManagerBase::$factory protected property The object that instantiates plugins managed by this manager.
PluginManagerBase::$mapper protected property The object that returns the preconfigured plugin instance appropriate for a particular runtime condition.
PluginManagerBase::getInstance public function Gets a preconfigured instance of a plugin. Overrides MapperInterface::getInstance 7
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UseCacheBackendTrait::$cacheBackend protected property Cache backend instance.
UseCacheBackendTrait::$useCaches protected property Flag whether caches should be used or skipped.
UseCacheBackendTrait::cacheGet protected function Fetches from the cache backend, respecting the use caches flag. 1
UseCacheBackendTrait::cacheSet protected function Stores data in the persistent cache, respecting the use caches flag.