You are here

public function Video::appliesTo in Lightning Media 8.4

Same name and namespace in other branches
  1. 8 modules/lightning_media_video/src/Plugin/media/Source/Video.php \Drupal\lightning_media_video\Plugin\media\Source\Video::appliesTo()
  2. 8.2 modules/lightning_media_video/src/Plugin/media/Source/Video.php \Drupal\lightning_media_video\Plugin\media\Source\Video::appliesTo()
  3. 8.3 modules/lightning_media_video/src/Plugin/media/Source/Video.php \Drupal\lightning_media_video\Plugin\media\Source\Video::appliesTo()

Checks if this media type can handle a given input value.

Parameters

mixed $value: The input value.

\Drupal\media\MediaTypeInterface $bundle: The media bundle that is using this plugin.

Return value

bool TRUE if the input can be handled by this plugin, FALSE otherwise.

Overrides InputMatchInterface::appliesTo

File

modules/lightning_media_video/src/Plugin/media/Source/Video.php, line 17

Class

Video
Input-matching version of the VideoEmbedField media type.

Namespace

Drupal\lightning_media_video\Plugin\media\Source

Code

public function appliesTo($value, MediaTypeInterface $media_type) {
  $value = $this
    ->toString($value);
  return isset($value) ? (bool) $this->providerManager
    ->loadProviderFromInput($value) : FALSE;
}