Problem/Motivation
Drupal 8.0.0-beta2 broke field output because hook_theme()
now assumes a template is in use unless a function is specified. I've just committed the specification of theme_youtube_video
and theme_youtube_thumbnail
in hook_theme()
to supply a fix for this problem, but I'd rather move towards using templates that prepare the necessary variables in preprocess functions.
Proposed resolution
Convert theme_youtube_video()
and theme_youtube_thumbnail()
to templates that use variables prepared in preprocess functions. hook_theme()
will need to be made aware of these templates.
Remaining tasks
Everything in the Proposed resolution.
Original report by amitgoyal
I just cloned the latest code from git repo and was able to input the youtube video in youtube field added in my article content type.
But on display page, I am just getting "Youtube: modules/contrib/youtube/templates/youtube-video.html.twig" rather than actual youtube video. When I looked into module folder, I didn't find "templates" folder there.
I am using drupal 8.x-beta2 version.
Comments
Comment #2
guschilds CreditAttribution: guschilds commentedThanks for pointing this out amitgoyal. This is because of a new change in Drupal 8.0.0-beta2, #2226207: Make 'template' the default output option for hook_theme(). I've committed a quick fix that will solve this problem for you. I've also updated this issue's title and description to point to a slightly different solution I'd like to implement when I've got the time. Thanks again!
Comment #6
guschilds CreditAttribution: guschilds at Chromatic commentedThis work is complete and has been committed to the 8.x-1.x branch. Videos and thumbnails are no longer rendered through theme functions. They are rendered through templates and use preprocess functions to prepare the variables for those templates.