You are here

public static function Vimeo::getIdFromInput in Video Embed Field 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/video_embed_field/Provider/Vimeo.php \Drupal\video_embed_field\Plugin\video_embed_field\Provider\Vimeo::getIdFromInput()

Get the ID of the video from user input.

Parameters

string $input: Input a user would enter into a video field.

Return value

string The ID in whatever format makes sense for the provider.

Overrides ProviderPluginInterface::getIdFromInput

File

src/Plugin/video_embed_field/Provider/Vimeo.php, line 61

Class

Vimeo
A Vimeo provider plugin.

Namespace

Drupal\video_embed_field\Plugin\video_embed_field\Provider

Code

public static function getIdFromInput($input) {
  preg_match('/^https?:\\/\\/(www\\.)?vimeo.com\\/(channels\\/[a-zA-Z0-9]*\\/)?(?<id>[0-9]*)(\\/[a-zA-Z0-9]+)?(\\#t=(\\d+)s)?$/', $input, $matches);
  return isset($matches['id']) ? $matches['id'] : FALSE;
}