You are here

protected function Video::toString in Varbase Media 8.5

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 src/Plugin/media/Source/Video.php
Checks if this media type can handle a given input value.

File

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

Class

Video
Input-matching version of the VideoEmbedField media type.

Namespace

Drupal\varbase_media\Plugin\media\Source

Code

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