You are here

protected function SubstitutionManager::filterPlugins in Linkit 8.5

Filter the list of plugins by their applicability.

Parameters

array $definitions: An array of plugin definitions.

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type to get applicable plugins for.

Return value

array The definitions appropriate for the given entity type.

See also

SubstitutionInterface::isApplicable()

1 call to SubstitutionManager::filterPlugins()
SubstitutionManager::getApplicablePluginsOptionList in src/SubstitutionManager.php
Get a form API options list for the entity ID.

File

src/SubstitutionManager.php, line 69

Class

SubstitutionManager
A plugin manager for the substitution plugins.

Namespace

Drupal\linkit

Code

protected function filterPlugins(array $definitions, EntityTypeInterface $entity_type) {
  return array_filter($definitions, function ($definition) use ($entity_type) {

    /** @var \Drupal\linkit\SubstitutionInterface $class */
    $class = $definition['class'];
    return $class::isApplicable($entity_type);
  });
}