fkelly12054 / juicebox-kelly

Juicebox moving towards Drupal 9
GNU General Public License v2.0
1 stars 1 forks source link

Possible regression based on media fix #13

Open fkelly12054 opened 3 years ago

fkelly12054 commented 3 years ago

Notice: Undefined index: imageURL in Drupal\juicebox\JuiceboxFormatter->styleImageSrcData() (line 279 of D:\webpage\drupal8\modules\juicebox\src\JuiceboxFormatter.php).

The above msg is from my local Drupal 8 site when I go to edit a content type with a media image in it. The function in question appears to assume that there is a thumbnail url. If we simply put a media image into a content type, it won't have a thumbnail and when styleImageSrcData() runs it will generate an error. In other words, in a "normal" gallery there will always be an image (and imageurl and a thumbnail and thumbnailurl. But in a gallery with media images that won't be true.

We could do some isset checks to make sure we aren't referencing an empty or non-existent array element. I'm not even sure styleImageSrcData needs to be called for content types that just have a media field in them. Maybe I'll do some var_dumps to see what kind of data is being passed in different circumstances.

fkelly12054 commented 3 years ago

I don't think that either the styleImageSrcData or the styleImage functions are getting called when what I'd call a "normal" Juicebox Gallery (we also have referred to it as "prebuilt") is edited. I have to stop for the day, but I'll work on it tomorrow.

fkelly12054 commented 3 years ago

Still want to try to make this work. Looking at juiceboxfieldformatter.php. This calls styleImageSrcData a function in Juiceboxformatter.php. What I am puzzled by right now is where the thumbnail info is supposed to come from. If I put a plain old image or a media image in I don't have a thumbnail. ? right? So we would seem to run into problems with this accessing a non-existent variable or array element. Work in progress.