public function ProviderManager::loadApplicableDefinitionMatches in Video 8
Same name and namespace in other branches
- 8.2 src/ProviderManager.php \Drupal\video\ProviderManager::loadApplicableDefinitionMatches()
Get the provider applicable to the given user input.
Parameters
array $definitions: A list of definitions to test against.
$user_input: The user input to test against the plugins.
Return value
\Drupal\video\ProviderPluginInterface|bool The relevant plugin or FALSE on failure.
Overrides ProviderManagerInterface::loadApplicableDefinitionMatches
File
- src/
ProviderManager.php, line 55
Class
- ProviderManager
- Gathers the provider plugins.
Namespace
Drupal\videoCode
public function loadApplicableDefinitionMatches(array $definitions, $user_input) {
foreach ($definitions as $definition) {
foreach ($definition['regular_expressions'] as $reqular_expr) {
if (preg_match($reqular_expr, $user_input, $matches)) {
return [
'definition' => $definition,
'matches' => $matches,
];
}
}
}
return FALSE;
}