born05 / craft-imagehotspots

Image Hotspots fieldtype for Craft CMS
Other
5 stars 3 forks source link

Multiple assets per entry #2

Closed wallacio closed 3 years ago

wallacio commented 3 years ago

I have discovered that this doesn't allow multiple assets per entry. Or at least, the hotspot picker defaults to use the first asset in the list.

It would be great to see this plugin able to handle multiple assets, and hotspots unique to those assets, all in the same entry.

wallacio commented 3 years ago

Update! This plugin is smarter than me. For anyone else finding themselves in this position, this appears to work:

Now, using multiple images with hotspots is a case of adding matrix blocks until your browser can't cope.

roelvanhintum commented 3 years ago

@wallacio thanks for the update! I tried to describe this, if the docs are unclear please let me know. It uses tree traversal to find the first field with a matching name. So there could be multiple levels between the fields. You could also use the same pattern and names at a different depths in your tree as long as they don't cross.

Are you still missing functionality or does this solve it for you?

wallacio commented 3 years ago

No missing functionality but if there's any improvement to the docs to be made it would be an example of how to include multiple images, themselves with multiple hotspots in an entry. My use-case is various perspectives/views of a map (as an image, nothing with lat/long) on a page, map having a different placement of markers.

Thanks!

matteveryday commented 3 years ago

Hi @roelvanhintum I'm curious if the Image hotspot field supports the Neo plugin for building complex matrixes? I'm trying to set this up inside of a Neo block and not seeing the Hotspot button. My first guess is that there's an issue with the hierarchy / placement of the fields within the tree, but not sure if I'm missing something?

Screen Shot 2021-04-30 at 9 00 50 AM
roelvanhintum commented 3 years ago

@matteveryday, the plugin traverses the tree, so it should find the field. I don't know if this works different with Neo.

Judging by the screenshot, the entry should be saved first after adding an image. The button should be visible after saving.

matteveryday commented 3 years ago

I should have mentioned that the screenshot is after already saving the entry. ha.

roelvanhintum commented 3 years ago

@matteveryday how is your field structured? I'm having some trouble reproducing this.

matteveryday commented 3 years ago

@roelvanhintum here's some screenshots of my structure for reference...

Block "Hero Hotspot Test" contains the image field.

Screen Shot 2021-04-30 at 11 23 31 AM

The Child Block "Hotspot Content" contains a simple heading and the hotspot field. (in this sense, I'm attempting to add multiple hotspots to the same image with the repeatable child block similar to the SuperTable example above.

Screen Shot 2021-04-30 at 11 23 44 AM

The hotspot Image Hotspot field is set up to target the image Asset field.

Screen Shot 2021-04-30 at 11 29 15 AM
roelvanhintum commented 3 years ago

@matteveryday fixed in 1.1.0

matteveryday commented 3 years ago

@roelvanhintum Thank you! I updated and everything is working nicely now 😄