I have been trying to figure out how to have the videos pulled in using the Brightcove module display differently depending on how they are called. For example, we have a video in the hero area of every page created using one content type. Here, we only want the video thumb and the path to the video's entity/node itself. We also have a view that should show thumbnail, video title, length and that, too, should be linked to the video's node/entity. Then, on the video's node/entity page, we want more information to show: description, the video player itself, release date, etc.
As far as I can tell, however, I cannot assign different, custom view modes to Brightcove videos. The only place I see anything that looks like a display settings page is within the "Brightcove Video Settings" page under Structure. I tried using a template to show only what I need, but, for example, when I created a suggested template - field--default--node--field-brightcove-video--animals.html.twig - and attempted a kint(content) on it, all I got was NULL.
I am sure I am just missing something, but how do others that want to show different parts of the imported video information depending on page/location do so? Do you make it all happen using views? That doesn't seem very intuitive... Please help!
Comment | File | Size | Author |
---|---|---|---|
#8 | Brightcove-add-entity-template-2875507-8.patch | 1.39 KB | oknate |
Comments
Comment #2
justkristin CreditAttribution: justkristin commentedI figured out how to use display modes to do what I needed. Sorry about the confusion (mine). :)
Thanks, @entuland!
Comment #3
justkristin CreditAttribution: justkristin commentedComment #4
cman9090 CreditAttribution: cman9090 commentedAlso having the same issue. There is like a half baked implementation of a media entity for Brightcove which would handle this situation but not sure how to import all the videos into this media entity instead of the normal brightcove video entity?
Comment #5
cman9090 CreditAttribution: cman9090 commentedOkay, to answer my own question. To be able to use different display modes for a video, we will need to use Brightcove video media entity. I've written some instructions on how to do that here. https://www.drupal.org/docs/8/modules/brightcove/brightcove-video-as-med...
It's an extra editorial step but it gives us greater control over displays, tagging etc.
Comment #6
oknatesee patch #8
Comment #7
oknateI was missing the template file in the last patch, adding, see patch #8
Comment #8
oknatelast patch was off, rerolling.
This patch creates a template for the brightcove_video entity, and sets up theme template suggestions for view modes.
So if you create a teaser video mode, you could use a template brightcove-video--teaser.html.twig.
Comment #10
yce CreditAttribution: yce at Pronovix for BrightCove commentedHi,
Thanks for the patch, pushed to dev.
I have simplified the brightcove_theme_suggestions_brightcove_video_alter() function a little bit, the suggestions variable is always an array and it is not necessary to define extra variables that are won't be used later.