public static function BrightcovePlaylist::getTypes in Brightcove Video Connect 8
Same name and namespace in other branches
- 8.2 src/Entity/BrightcovePlaylist.php \Drupal\brightcove\Entity\BrightcovePlaylist::getTypes()
- 3.x src/Entity/BrightcovePlaylist.php \Drupal\brightcove\Entity\BrightcovePlaylist::getTypes()
Get Playlist types.
Parameters
int|null $type: Get specific type of playlist types. Possible values are TYPE_MANUAL, TYPE_SMART.
Return value
array Manual and smart playlist types.
Throws
\Exception If an invalid type was given.
See also
http://docs.brightcove.com/en/video-cloud/cms-api/references/playlist-fi...
2 calls to BrightcovePlaylist::getTypes()
- BrightcovePlaylist::typeAllowedValues in src/
Entity/ BrightcovePlaylist.php - Implements callback_allowed_values_function().
- BrightcovePlaylistForm::buildForm in src/
Form/ BrightcovePlaylistForm.php - Form constructor.
File
- src/
Entity/ BrightcovePlaylist.php, line 99
Class
- BrightcovePlaylist
- Defines the Brightcove Playlist.
Namespace
Drupal\brightcove\EntityCode
public static function getTypes($type = NULL) {
$manual = [
'EXPLICIT' => t('Manual: Add videos manually'),
];
$smart_label = t('Smart: Add videos automatically based on tags')
->render();
$smart = [
$smart_label => [
'ACTIVATED_OLDEST_TO_NEWEST' => t('Smart: Activated Date (Oldest First)'),
'ACTIVATED_NEWEST_TO_OLDEST' => t('Smart: Activated Date (Newest First)'),
'ALPHABETICAL' => t('Smart: Video Name (A-Z)'),
'PLAYS_TOTAL' => t('Smart: Total Plays'),
'PLAYS_TRAILING_WEEK' => t('Smart: Trailing Week Plays'),
'START_DATE_OLDEST_TO_NEWEST' => t('Smart: Start Date (Oldest First)'),
'START_DATE_NEWEST_TO_OLDEST' => t('Smart: Start Date (Newest First)'),
],
];
// Get specific type of playlist if set.
if (!is_null($type)) {
switch ($type) {
case self::TYPE_MANUAL:
return $manual;
case self::TYPE_SMART:
return reset($smart);
default:
throw new \Exception('The type must be either TYPE_MANUAL or TYPE_SMART');
}
}
return $manual + $smart;
}