_blazy_photoswipe_5_options() is overwriting configured options

Created on 2 April 2024, 3 months ago
Updated 16 April 2024, 2 months ago

Problem/Motivation

Me again :)

The array_merge call when checking for PS5 is overwriting options configured in the Photoswipe settings. I think the solution is to switch the arguments.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇸United States KarlShea Minneapolis, 🇺🇸

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

Merge Requests

Comments & Activities

  • Issue created by @KarlShea
  • Merge request !3Prevent overwriting user options → (Merged) created by KarlShea
  • Status changed to Needs review 3 months ago
  • 🇺🇸United States KarlShea Minneapolis, 🇺🇸
  • Pipeline finished with Success
    3 months ago
    Total: 188s
    #135626
  • 🇮🇩Indonesia gausarts

    Thank you.

    I don't remember precisely, but two reasons:

    • I don't like the original module default values, due to issues I also don' t remember :)
    • They are both equally default aka dead configs, so it makes no difference.

    Could you confirm those defaults are different for some values?

    If no difference, worth your reversal.
    If any difference, I might remember the issues.

  • 🇺🇸United States KarlShea Minneapolis, 🇺🇸

    The issue I'm hitting is that I changed background opacity in the Photoswipe module settings (/admin/config/media/photoswipe) to 0.6. So the $options array starts with bgOpacity of 0.6 from the blazy settings call. Then the array_merge overwrites that with bgOpacity 0.97 from a hard-coded list (and the same would be true of any configurable setting like animation duration, type, etc).

    It is the case I could overwrite it again using the blazy_photoswipe_js_options alter hook, but why overwrite what the user has configured? I agree that it makes sense to have defaults in case they're not set up yet but I would have expected my site-wide Photoswipe settings to have also applied here.

  • 🇮🇩Indonesia gausarts

    Ah, makes sense.

    So we got configurable UI for this now?

    When it was written, there was no UI for that.
    If there is UI, this should be changed, then.

  • 🇺🇸United States KarlShea Minneapolis, 🇺🇸

    Ahhh if that was not configurable previously this all makes way more sense! Yes, that module has a UI for those settings.

  • Pipeline finished with Skipped
    3 months ago
    #135691
  • Status changed to Fixed 3 months ago
  • 🇮🇩Indonesia gausarts

    Yes, that is why I said dead configs.

    Committed. Thank you for contribution.

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

Production build 0.69.0 2024