Open fkelly12054 opened 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.
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.
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.