Problem/Motivation

Noticing in slick_views that the images were always loading the first image. #3085169: All Main stage items contain the path to the first image from the multi-upload field of the content type

Proposed resolution

Load the index requested.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new658 bytes

Here's a patch that did the trick for me.

Status: Needs review » Needs work

The last submitted patch, 2: 3086989-2-load-renderable-field-index.patch, failed testing. View results

joelpittet’s picture

Status: Needs work » Needs review

Not sure I understand the test failure.

Status: Needs review » Needs work

The last submitted patch, 2: 3086989-2-load-renderable-field-index.patch, failed testing. View results

gausarts’s picture

Thank you!
Please allow some time to get back into this.

Please ignore the test. Since Drupal 8.7 the tests randomly failed, other times passed, without any code changes.

joelpittet’s picture

Thanks I wonder if those test failures are due to timing issues since they are JS functional tests. I keep running into issues running those locally though so trickier to debug

gausarts’s picture

Probably timing. I haven't rechecked any other related methods to delay the execution. Strangely, often time they just passed.

joelpittet’s picture

@gausarts I don't think my patch is always correct, it's a bit confusing because sometimes the $index is dealing with a $row's index and other times it's a fields index.

It may be better to separate those into two functions?

In a different context with Views rows I changed that line to
return empty($result) ? [] : ($multiple ? $result[$index] : $result); and it fixed it.

gausarts’s picture

Yes, that will be fine. Thank you!

joelpittet’s picture

Status: Needs work » Postponed

I have managed to forget where the original issue happened... sorry. I'll postpone this until I find it.

gausarts’s picture

Category: Bug report » Task

Reducing the tension till you re-open it, hopefully with a repro on this, as we are planning for a full release.

Feel free to change it back the status once re-opened. Thanks!

capmex’s picture

I experienced the same issue on a multi-value image field displayed using a view (Slick Carousel format) on a product variation, using image thumbnails, the patch fixed it.

gausarts’s picture

Please install Slick example, and let me know.

5 of 6 samples are multi-value with thumb navigation similar to your setup, except the Main.

Also be sure to read Slick Views home page and docs for the proven architecture to work with.

In your case (multi-value image):
1. Choose Unformatted list, not Slick carousel, pager 1, check Use field template under Styling, Display all values in the same row with 0 under Display, etc. In this case choose Slick carousel under Image formatter.
2, Choose Slick Carousel if you really have to, pager 3-N, uncheck Use field template under Styling, Display all values in the same row with 1 under Display, etc. In this case choose Blazy or Image, etc., exept Slick carousel, under Image formatter.
3. View more recipes at Slick Views.

Behold for different setup, few of those options are the opposite!

Changing the behavior without considering different setups will immediately break the working samples, if not blank.

Too many to explain, sorry. If you do see problems, consider correct provided recipes, or current limitations if you wish. Yet those recipes are already cooked at Slick example. Please start with it.

Feel free to explore, yet if in trouble, be sure to just clone and use the working recipes.

They are already in docs, anyway.

Regarding patch, if I applied it, it would break existing setups different from yours, so further considerations/ works are still required if re-opened.

That is why I would recommend installing the samples, and putting this on Postponed.

UPDATE:
Updated instructions to explore possibilities specific to your setup as long as you can input the correct logic.

gausarts’s picture

What I meant by "clone" is not simply hitting Clone button, but rather mapping options from the working samples to your setups so you can be exercised in the longer run. If you found, yours is not working like the samples, you are being told/guided by sample to correct it.

gausarts’s picture

Category: Task » Support request
Status: Postponed » Fixed

Marking this Fixed since it should work correctly given different setups with the correct, or at least expected, input/logic.

Feel free to re-open if still an issue, or again check out each project docs, hence Slick Views, or comment no. 14 above specific to this issue.

gausarts’s picture

Issue tags: +slick gotchas

Tagging for easy finding.

Status: Fixed » Closed (fixed)

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