You are here

protected function Video::toString in Lightning Media 8.3

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

Safely converts a value to a string.

The value is converted if it is either scalar, or an object with a __toString() method.

Parameters

mixed $value: The value to convert.

Return value

string|null The string representation of the value, or NULL if the value cannot be converted to a string.

1 call to Video::toString()
Video::appliesTo in modules/lightning_media_video/src/Plugin/media/Source/Video.php
Checks if this media type can handle a given input value.

File

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

Class

Video
Input-matching version of the VideoEmbedField media type.

Namespace

Drupal\lightning_media_video\Plugin\media\Source

Code

protected function toString($value) {
  return is_scalar($value) || is_object($value) && method_exists($value, '__toString') ? (string) $value : NULL;
}