Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Now when you make a view, by default the only image type not visible to choose is "thumbnailURL", It would be interesting choose between thumbnailURL and videoStillURL because the last one is bigger.
The Previous code:
if ($instance['widget']['type'] == BRIGHTCOVE_VIDEO_WIDGET) {
$image_types = array(
'thumbnailURL' => t('thumbnailURL'),
'videoStillURL' => t('videoStillURL'),
);
$element['brightcove_image_type'] = array(
'#title' => t('Image type'),
'#type' => 'select',
'#default_value' => $settings['brightcove_image_type'],
'#empty_option' => $image_types[0],
'#options' => $image_types,
);
}
else {
$element['brightcove_image_type'] = array(
'#type' => 'value',
'#value' => 'thumbnailURL',
);
}
My solution, deleting the if statement.
$image_types = array(
'thumbnailURL' => t('thumbnailURL'),
'videoStillURL' => t('videoStillURL'),
);
$element['brightcove_image_type'] = array(
'#title' => t('Image type'),
'#type' => 'select',
'#default_value' => $settings['brightcove_image_type'],
'#empty_option' => $image_types[0],
'#options' => $image_types,
);
My patch:
Comment | File | Size | Author |
---|---|---|---|
#1 | brightcove-image-type-2267029.patch | 1.38 KB | jansete |
Comments
Comment #1
jansete CreditAttribution: jansete commentedComment #2
k.dani CreditAttribution: k.dani commentedThe problem with your solution is that the Brightcove playlist object do not have 'videoStillURL' parameter, so playlists don't have this kind of image type: http://docs.brightcove.com/en/video-cloud/media/reference.html#Playlist
The problem source is related to views. It always uses the default 'widget type' for a field.
Anyway, the default widget type has been set to brightcove video (#2265967: 'default_widget' inside hook_field_info is set to a widget that doesn't exist.) so that the 'videoStillURL' is available on views admin as well.