protected function Facebook::getFacebookUrl in Media entity facebook 8
Runs preg_match on embed code/URL.
Parameters
MediaInterface $media: Media object.
Return value
string|false The facebook url or FALSE if there is no field or it contains invalid data.
1 call to Facebook::getFacebookUrl()
- Facebook::getField in src/
Plugin/ MediaEntity/ Type/ Facebook.php - Gets a media-related field/value.
File
- src/
Plugin/ MediaEntity/ Type/ Facebook.php, line 131
Class
- Provides media type plugin for Facebook.
Namespace
Drupal\media_entity_facebook\Plugin\MediaEntity\TypeCode
protected function getFacebookUrl(MediaInterface $media) {
if (isset($this->configuration['source_field'])) {
$source_field = $this->configuration['source_field'];
if ($media
->hasField($source_field)) {
$property_name = $media->{$source_field}
->first()
->mainPropertyName();
$embed = $media->{$source_field}->{$property_name};
return static::parseFacebookEmbedField($embed);
}
}
return FALSE;
}