You are here

public function ProviderManager::filterApplicableDefinitions in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 src/ProviderManager.php \Drupal\video_embed_field\ProviderManager::filterApplicableDefinitions()

Get the provider applicable to the given user input.

Parameters

array $definitions: A list of definitions to test against.

string $user_input: The user input to test against the plugins.

Return value

\Drupal\video_embed_field\ProviderPluginInterface|bool The relevant plugin or FALSE on failure.

Overrides ProviderManagerInterface::filterApplicableDefinitions

1 call to ProviderManager::filterApplicableDefinitions()
ProviderManager::loadDefinitionFromInput in src/ProviderManager.php
Load a plugin definition from an input.

File

src/ProviderManager.php, line 56

Class

ProviderManager
Gathers the provider plugins.

Namespace

Drupal\video_embed_field

Code

public function filterApplicableDefinitions(array $definitions, $user_input) {
  foreach ($definitions as $definition) {
    $is_applicable = $definition['class']::isApplicable($user_input);
    if ($is_applicable) {
      return $definition;
    }
  }
  return FALSE;
}