You are here

public static function Facebook::getIdFromInput in Video Embed Facebook 8

1 call to Facebook::getIdFromInput()
ProviderUrlParseTest::testUrlParsing in tests/src/Unit/ProviderUrlParseTest.php
@dataProvider urlsWithExpectedIds

File

src/Plugin/video_embed_field/Provider/Facebook.php, line 45

Class

Facebook
Plugin annotation @VideoEmbedProvider( id = "facebook", title = @Translation("Facebook") )

Namespace

Drupal\video_embed_facebook\Plugin\video_embed_field\Provider

Code

public static function getIdFromInput($input) {
  preg_match('/^https?:\\/\\/(www\\.)?facebook.com\\/([\\w\\-\\.]*\\/videos\\/|video\\.php\\?v\\=)(?<id>[0-9]*)\\/?$/', $input, $matches);
  return isset($matches['id']) ? $matches['id'] : FALSE;
}