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

  • guschilds committed 07fec94 on 8.x-1.x
    Issue #2358647 by amitgoyal, guschilds: Specified theme functions to fix...
guschilds’s picture

Title: Looks like template folder is missing » [8.x] Switch use of theme functions for templates
Category: Bug report » Task
Issue summary: View changes

Thanks 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!

  • guschilds committed 00b0dc8 on 8.x-1.x
    Issue #2358647 by guschilds: Changed rendering of a YouTube video from a...

  • guschilds committed 5c3bb37 on 8.x-1.x
    Issue #2358647 by guschilds: Changed the video wrapper element type and...

  • guschilds committed 2e01dbb on 8.x-1.x
    Issue #2358647 by guschilds: Changed rendering of a YouTube thumbnail...
guschilds’s picture

Status: Active » Fixed

This 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.