alterInfo('video_embed_field_provider_info'); } /** * {@inheritdoc} */ public function getProvidersOptionList() { $options = []; foreach ($this->getDefinitions() as $definition) { $options[$definition['id']] = $definition['title']; } return $options; } /** * {@inheritdoc} */ public function loadDefinitionsFromOptionList($options) { $definitions = []; // When no options are selected, all plugins are applicable. if (count(array_keys($options, '0')) == count($options) || empty($options)) { return $this->getDefinitions(); } else { foreach ($options as $provider_id => $enabled) { if ($enabled) { $definitions[$provider_id] = $this->getDefinition($provider_id); } } } return $definitions; } /** * {@inheritdoc} */ 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; } /** * {@inheritdoc} */ public function loadProviderFromInput($input) { $definition = $this->loadDefinitionFromInput($input); return $definition ? $this->createInstance($definition['id'], ['input' => $input]) : FALSE; } /** * {@inheritdoc} */ public function loadDefinitionFromInput($input) { return $this->filterApplicableDefinitions($this->getDefinitions(), $input); } }