protected function Soundcloud::getMediaUrl in Media entity Soundcloud 8
Returns the track id from the source_url_field.
Parameters
\Drupal\media_entity\MediaInterface $media: The media entity.
Return value
string|bool The track if from the source_url_field if found. False otherwise.
1 call to Soundcloud::getMediaUrl()
- Soundcloud::getField in src/
Plugin/ MediaEntity/ Type/ Soundcloud.php - @inheritDoc
File
- src/
Plugin/ MediaEntity/ Type/ Soundcloud.php, line 187
Class
- Soundcloud
- Provides media type plugin for Soundcloud.
Namespace
Drupal\media_entity_soundcloud\Plugin\MediaEntity\TypeCode
protected function getMediaUrl(MediaInterface $media) {
if (isset($this->configuration['source_url_field'])) {
$source_url_field = $this->configuration['source_url_field'];
if ($media
->hasField($source_url_field)) {
if (!empty($media->{$source_url_field}
->first())) {
$property_name = $media->{$source_url_field}
->first()
->mainPropertyName();
return $media->{$source_url_field}->{$property_name};
}
}
}
return FALSE;
}