public function Slideshow::getField in Media entity slideshow 8
Gets a media-related field/value.
Parameters
MediaInterface $media: Media object.
string $name: Name of field to fetch.
Return value
mixed Field value or FALSE if data unavailable.
Overrides MediaTypeInterface::getField
1 call to Slideshow::getField()
- Slideshow::getDefaultName in src/
Plugin/ MediaEntity/ Type/ Slideshow.php - Provide a default name for the media.
File
- src/
Plugin/ MediaEntity/ Type/ Slideshow.php, line 34
Class
- Slideshow
- Provides media type plugin for Slideshows.
Namespace
Drupal\media_entity_slideshow\Plugin\MediaEntity\TypeCode
public function getField(MediaInterface $media, $name) {
$source_field = $this->configuration['source_field'];
switch ($name) {
case 'length':
return $media->{$source_field}
->count();
}
return FALSE;
}