protected function Facebook::getFacebookUrl in Media entity facebook 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/media/Source/Facebook.php \Drupal\media_entity_facebook\Plugin\media\Source\Facebook::getFacebookUrl()
Runs preg_match on embed code/URL.
Parameters
\Drupal\media\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::getMetadata in src/
Plugin/ media/ Source/ Facebook.php - Gets the value for a metadata attribute for a given media item.
File
- src/
Plugin/ media/ Source/ Facebook.php, line 139
Class
- Facebook entity media source.
Namespace
Drupal\media_entity_facebook\Plugin\media\SourceCode
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;
}