Allow media entity reference fields to be displayed as a gallery in a colorbox

Created on 29 March 2018, almost 7 years ago
Updated 26 August 2024, 5 months ago

Problem/Motivation

The existing colorbox formatter is specifically for image fields. It is currently not possible to display a media entity reference field as a gallery with colorbox.

Proposed resolution

Add a new formatter to support other types of entity reference fields. The formatter should allow the user to configure a view mode for diaply in the content, and a view mode for display in the colorbox.

Remaining tasks

  • Review

User interface changes

New formatter

API changes

Data model changes

✨ Feature request
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡«πŸ‡·France matoeil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France dydave

    Hi everyone,

    Thanks a lot for contributing this patch and a lot of help in this ticket with how to enable the colorbox module with various advanced setups, in particular using paragraphs or Media entity reference fields.

    Please find attached to this comment a re-rolled patch addressing the last comment #41, where the support for `dompurify` was ported from 'ColorboxFormatter.php':
    File attached as: 2957030-42-colorbox-entity_reference_formatter.patch β†’

    Additionally, since 2.0.x has now become the default branch, the patch was rerolled for this branch and the version of the ticket updated.
     

    Lastly, I would like to second the comment above at #39 and clearly state the patch is absolutely necessary if you're trying to build a more advanced gallery browsing experience, with pararaphs for example, from which the fields can be pulled and assembled with various values and logic in the preprocessing or theme layer.
    On top of that, this patch really adds an amazing flexibility and functionality to the module, therefore, it would definitely make it much better.

    We would greatly appreciate if a maintainer or someone with committing rights could please try taking a look at this patch and let us know if you would see anything that could prevent it from being added to the module.

    Could you please give us your feedback and let us know if it is working as expected?

    Feel free to let us know if you have any questions, requests or concerns on any aspects of this new patch or the ticket in general, we would be delighted to provide more information or take another look at the changes needed.
    Thanks a lot to everyone for your great help and contributions.

  • πŸ‡ΊπŸ‡ΈUnited States ja09

    5 years old now. Is this going to make it into a stable release? This module has limited to no usefulness these days if it doesn't support media entities.

    #42 seems to be working well and I'll report back if I have any issues with the patch. Thanks everyone for your work!

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    PhotoSwipe β†’ supports this.

  • πŸ‡ͺπŸ‡ΈSpain candelas

    Thanks @DYdave. patch in #42 works!

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    Patch Failed to Apply
  • I had a problem with displaying double entities and a popup in inspect mode. Here is the corrected version.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    Checkout Error
  • I had a problem with displaying double entities and a popup in inspect mode. Here is the corrected version.

  • Assigned to dww
  • πŸ‡ΊπŸ‡ΈUnited States dww

    I've also been successfully using #42 for a client site for quite a while. It'd be great to get this in. There's now a 2.1.x branch, but sadly no 2.1.x version to use in issues. I'll convert this to an MR that merges cleanly to 2.1.x to hopefully move this forward. Stay tuned.

  • Pipeline finished with Success
    6 months ago
    Total: 185s
    #247332
  • Pipeline finished with Success
    6 months ago
    Total: 161s
    #247340
  • Issue was unassigned.
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Okay, this is ready for review again. There's a lot of noise in the GitLab pipeline output, since the baseline 2.1.x runs are full of warnings. πŸ˜… I fixed the new phpstan error introduced via this patch, but otherwise, I didn't touch anything to get the rest of the warnings green, since that'd all be scope creep in here.

  • Pipeline finished with Success
    6 months ago
    Total: 146s
    #248153
  • πŸ‡«πŸ‡·France dydave

    Thanks a lot Derek (@dww)!

    Great work putting together a merge request and we're certainly hoping this could land in the 2.1.x branch at some point 🀞

    I didn't touch anything to get the rest of the warnings green, since that'd all be scope creep in here.

    Following your comment, we've done a round of changes already and got everything fixed except ESLint, which is more complicated, would take more time and risk breaking things, otherwise, see:

     
    Feel free to let us know if you would need any help getting this one over the line or with any other issue in the module, we would surely be glad to help.
    Thanks in advance for the reviews and feedback!

  • First commit to issue fork.
  • Status changed to Fixed 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States paulmckibben Atlanta, GA

    Thanks to everyone for their work on this. This is now committed.

  • πŸ‡«πŸ‡·France dydave

    Thanks a lot Paul (@paulmckibben)! πŸ™‚

    Super happy to see this issue finally making it into the the module πŸŽ‰

    Thanks also very much for merging other merge requests and getting all the jobs (except ESLint) passing green 🟒
    https://git.drupalcode.org/project/colorbox/-/pipelines/251999

    Cheers!

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

Production build 0.71.5 2024