Undefined index: autoplay, enablejsapi, loop, modestbranding
media_youtube_preprocess_media_youtube_video()
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 33

Undefined index: enablejsapi
media_youtube_preprocess_media_youtube_video(
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 37

Undefined index: loop
media_youtube_preprocess_media_youtube_video()
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 52

Undefined index: rel, showinfo
media_youtube_preprocess_media_youtube_video()
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 58

Undefined index: theme
media_youtube_preprocess_media_youtube_video()
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 68, 69

Undefined index: color
media_youtube_preprocess_media_youtube_video()
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 71, 72

Undefined index: autohide
media_youtube_preprocess_media_youtube_video()
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 74, 75

Undefined index: nocookie
media_youtube_preprocess_media_youtube_video()
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 79

Undefined index: protocol_specify
media_youtube_preprocess_media_youtube_video()
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 86

Undefined index: width, height
media_youtube_preprocess_media_youtube_video()
sites/all/modules/media_youtube/includes/themes/media_youtube.theme.inc
line 95

Comments

Status:Active» Needs review
StatusFileSize
new3.13 KB

Thanks for the patch. Can you tell us how to reproduce the errors?

Title:Php notices in media_youtube.theme.incphp notices in media_youtube.theme.inc
StatusFileSize
new4.06 KB

happens on node/add and node/*/edit pages according to the logs. It does not happen for me so it seems to only happen to certain users. Updated patch to take care of the missing width and height.

Hmm, this is interesting. !empty() isn't going to work, because if something is set to 0 or false it's not empty and it shouldn't trigger the conditional. Sorry, of course I was thinking of isset(). It sounds like $variables['option'] isn't coming through for some users. Is it possible you're overwriting that array with a preprocess? Or maybe the ctools defaults for the variables aren't getting through. If you can give some more info to reproduce maybe we can fix the source of the problem.

!empty() will actually work. If something was set to 0 or false it would be skipped in the old logic, and it will be skipped with the new logic as well.

<?php
   
if ($variables['options'][$option]) {} // Old.
   
if (!empty($variables['options'][$option])) {} // New.
?>

if $variables['options'][$option] = 0 both if statements will be skipped.

I've put in some debugging code to capture the $variables variable when this happens.

Did some digging, this is the source of the issue for me
http://drupal.stackexchange.com/questions/18363/given-a-file-id-fid-how-...

Do you have a good idea on how to load the options in if the only thing given is the file id?

#5, totally right.
#6, I've come across that before, don't know how I worked around it. I'll take a look and ask some compatriots -- I'd rather figure out how to fix that issue than add !empty() checks to every options check.

StatusFileSize
new1019 bytes

What if we added in the defaults to the options?

Better idea would be to use media_youtube_file_formatter_info(); correct?

Edit: I've updated the code example on stack exchange to load file_info_formatter_types's default_settings into the $options key when getting passed to drupal_render.

Thanks for really digging into this. The variables are all stored in media_youtube.variables.inc, so there shouldn't be a need to redeclare them, which it looks like you figured out already. The code sample you've given looks good, although there should be a way to load the settings off of the specific formatter chosen as opposed to the defaults.

You might want to ask in the Media queue as well -- I think it's a good bet someone has run into a similar issue before.

Let me know what you come up with. I'd like to include it in the next revision of the readme.