- πΊπ¦Ukraine dinazaur
I guess this should remain postponed until https://www.drupal.org/project/photoswipe/issues/3232070 β¨ [5.x] PhotoSwipe 5 Branch Fixed will be merged, because v5 of photoswipe provides new options, and we should wait until this issue will be merged.
- Status changed to Active
over 1 year ago 7:31am 19 July 2023 - π©πͺGermany Grevil
Photoswipe 5.x released! We can tackle this issue once again!
- π©πͺGermany Grevil
@imclean, the thought about different option sets sounds very interesting! Especially for a formatter such as Photoswipe! π
We could create a config entity class named "PhotoswipeOptionsSet" with its own collection, where new options sets could be created and removed. One default "PhotoswipeOptionsSet" is always created on install with the default options set. And people could select the options set they want on the formatter settings page! (With a link to the collection to create new options sets). This way, we don't "overload" the formatter settings page, as we already have 4 settings to set for the formatter. Adding another 12? even only through optionally enabling a checkbox would be way too much. Instead, a simple 5th setting, where the user can select their options set to use, would be amazing!
As an alternative, we could always just simply create a global settings page, where we can modify the values globally and individually per formatter through a hook. Or individually through an "override global options" checkbox on the formatter settings, where we can override the global settings for this specific formatter.
But I'd prefer the first option more, actually! Even if it is more work.
- π©πͺGermany Anybody Porta Westfalica
From my perspective, the optionset thing is (by far) to bloated for Photoswipe. Typically, you may want consistent UI within a project, which means the same functionality and look for the whole project.
I'm not against implementing this, but we as maintainers won't invest time into this functionality. I even think if someone does, it should be done as a submodule to keep the module simple for 95% of the use-cases.
For now, let's focus on the simple configuration page, there's enough more important things to be done! :)
(If important enough for someone, please split that larger part off into a separate feature request)
- π©πͺGermany Grevil
Yea, I don't agree with the UI part either. Like I said in my comment, I'd rather use config entities with the predefined "collection" page, similar to the COOKiES module:
But instead of services, we have "Options Sets". And these would be simply selectable through a "select" on the formatter settings page. This way we don't bloat the formatter settings page and users can use their different options set for different fields!
- π©πͺGermany Grevil
But I understand that this:
As an alternative, we could always just simply create a global settings page, where we can modify the values globally and individually per formatter through a hook [if necessary.]
Is the faster (and saner) approach.
- First commit to issue fork.
- Assigned to lrwebks
- π©πͺGermany lrwebks Porta Westfalica
On it,
implementing a global settings page with all the already given ones in the schema.yml. - π©πͺGermany Anybody Porta Westfalica
Are all options from https://photoswipe.com/options/ already present in the schema.yml? (Excluding the JS callbacks - these should be made available differently, perhaps exposing the globally initialized Photoswipe object to Drupal.photoswipe in the initializiation?
@Grevil: I think that should be a separate issue / follow-up? Would you mind having a look at that idea and creating the issue, perhaps also related to the thoughts and last comment from β¨ [5.x] Make photoswipe library attachable in theme ({ attach_photoswipe() }) Fixed ?
- last update
over 1 year ago 15 pass - @lrwebks opened merge request.
- last update
over 1 year ago 15 pass - Status changed to Needs review
over 1 year ago 12:57pm 3 August 2023 - π©πͺGermany lrwebks Porta Westfalica
Settings form created in general,
left out two settings that I was unsure about, since they are not documented on photoswipe.com. - π©πͺGermany Anybody Porta Westfalica
@LRWebks:
left out two settings that I was unsure about, since they are not documented on photoswipe.com.
Which ones?
- π©πͺGermany lrwebks Porta Westfalica
Left out the settings "maxZoomLevel" and "preload", which I have also left as a comment within the PhotoswipeAdminSettings.php
- last update
over 1 year ago 15 pass - Status changed to Needs work
over 1 year ago 3:39pm 3 August 2023 - π©πͺGermany Anybody Porta Westfalica
@LRWebks:
Re #23: I found the documentations!- maxZoomLevel: https://photoswipe.com/adjusting-zoom-level/
- preload: https://photoswipe.com/options/#preload
Please add them as described in the docs.
I also opened an issue to add "maxZoomLevel" to the options page: https://github.com/dimsemenov/PhotoSwipe/issues/2052
- π©πͺGermany Anybody Porta Westfalica
Some values are missing in the schema, the install file and here in the settings form. The one's that make sense, should be added. See comment.
See here for details: https://github.com/dimsemenov/PhotoSwipe/blob/31c8a855170fc747db08445cb0...
https://photoswipe.com/options/Missing configs (with their default values to use and the form element type to use):
- showAnimationDuration: 333 (integer input)
- zoomAnimationDuration: 333 (integer input)
- returnFocus: true (checkbox)
- maxWidthToAnimate: 4000 (integer input)
- clickToCloseNonZoomable: true (checkbox)
- imageClickAction: 'zoom-or-close' (select of all allowed values)
- bgClickAction: 'close' (select of all allowed values)
- tapAction: 'toggle-controls' (select of all allowed values)
- doubleTapAction: 'zoom' (select of all allowed values)
- indexIndicatorSep: ' / ' (text input)
- preloaderDelay: 2000 (integer input)
- easing: 'cubic-bezier(.4,0,.22,1)' (text input)
index
should not be added. - last update
over 1 year ago 19 pass - π©πͺGermany Grevil
We should also rename "PhotoswipeAdminSettings" to "PhotoswipeSettings", since the naming is very irregular inside the module (schema definition is "photoswipe.settings", settings form id is "photoswipe_admin_settings", etc.). Please resolve this naming issue as well.
- last update
over 1 year ago 19 pass - last update
over 1 year ago 21 pass - last update
over 1 year ago 17 pass - last update
over 1 year ago 17 pass - π©πͺGermany lrwebks Porta Westfalica
Added all the settings that @Anybody proposed from the photoswipe website and took into account most of his other suggestions and comments.
Note that the settings names in the form (not the ones that the values are saved under) needed to have the "." replaced with underscores in order for the page to properly work.
Not finished yet, will write a test for the settings page before putting the issue into review. - last update
over 1 year ago 13 pass, 4 fail - Status changed to Needs review
over 1 year ago 12:53pm 15 August 2023 - π©πͺGermany lrwebks Porta Westfalica
Added and ran a test for the Settings page (It works, by the way). This concludes my work here, I will put this issue into review now!
- Status changed to Needs work
over 1 year ago 3:30pm 15 August 2023 - π©πͺGermany Anybody Porta Westfalica
@LRWebks: 4 failing tests, back to needs work:
https://www.drupal.org/pift-ci-job/2740648 β - last update
over 1 year ago 19 pass - last update
over 1 year ago 20 pass - Status changed to Needs review
over 1 year ago 9:36am 16 August 2023 - π©πͺGermany lrwebks Porta Westfalica
Quickly fixed a few errors, among these a refactoring error (GeneralPhotoswipeTest.phph was named class PhotoswipeSettingsTest), and I hope it works now!
- Status changed to Needs work
over 1 year ago 12:14pm 16 August 2023 - πΊπ¦Ukraine dinazaur
Hello, from a quick review, I see that
hook_update_N
is missing. As we introduced new options we, also need to update the configuration in existing installations. - last update
over 1 year ago 20 pass - last update
over 1 year ago 20 pass, 1 fail - π©πͺGermany Grevil
Hm crazy, for some reason 'allowPanToNext' always stays FALSE inside the photoswipe object... No idea if this might be a library bug.
- π©πͺGermany Anybody Porta Westfalica
@Grevil: In the Photoswipe library it's even
true
by default.
See https://github.com/search?q=repo%3Adimsemenov%2FPhotoSwipe%20allowPanToN...So we should check that more in deep. One typical thing is type conversion bool vs. string etc. from PHP vs. JS.
'true' vs. TRUE vs. true in PHP / JS - do we have a bug here? - last update
over 1 year ago 20 pass, 1 fail - π©πͺGermany Grevil
@Anybody, as discussed internally, this was the problem:
if (!this.supportsTouch) { // disable pan to next slide for non-touch devices pswp.options.allowPanToNext = false; }
I'll adjust the 'allowPanToNext' description accordingly.
- last update
over 1 year ago 20 pass, 1 fail - last update
over 1 year ago 20 pass, 1 fail - π©πͺGermany Grevil
Ok, we still need to flush the correct cache after submitting the settings form. Otherwise, photoswipe will simply use the old cached values as the Functional Javascript test perfectly shows.
- last update
over 1 year ago 21 pass - last update
over 1 year ago 15 pass, 6 fail - last update
over 1 year ago 15 pass, 6 fail - π©πͺGermany Grevil
@LRWebks please check the remaining comments and adjust them accordingly on Monday. Afterwards @dinazaur or me will make a final review.
- π©πͺGermany Grevil
Oh, seems I broke something. I'll have a look tommorow.
- last update
over 1 year ago 21 pass - last update
over 1 year ago 21 pass - last update
over 1 year ago 21 pass - last update
over 1 year ago 19 pass, 3 fail - Status changed to RTBC
over 1 year ago 2:42pm 21 August 2023 - π©πͺGermany Grevil
Ok, I finally adjusted a few of the descriptions and fixed / tested the update hook. Everything works as expected!
Nice work @LRWebks, let's merge this, once the tests pass.
- last update
over 1 year ago 20 pass, 2 fail - last update
over 1 year ago 21 pass - last update
over 1 year ago 21 pass - Open on Drupal.org βCore: 10.0.7 + Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - Open on Drupal.org βCore: 10.0.7 + Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - Open on Drupal.org βCore: 10.0.7 + Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - Open on Drupal.org βCore: 10.0.7 + Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - last update
over 1 year ago 21 pass -
Grevil β
committed ac1af146 on 5.x authored by
LRWebks β
Issue #3021978: [5.x] Add photoswipe options UI (and optionally setting...
-
Grevil β
committed ac1af146 on 5.x authored by
LRWebks β
- Status changed to Fixed
over 1 year ago 7:15am 22 August 2023 - π©πͺGermany Grevil
Merged!
Please ignore the last couple commits in here. I reverted them and simply rebased.
-
Grevil β
committed 9e13e517 on 5.x authored by
LRWebks β
Hotfix: Adjusted maxZoomLevel data type, related to issue #3021978 (...
-
Grevil β
committed 9e13e517 on 5.x authored by
LRWebks β
- πΊπ¦Ukraine dinazaur
I'm sorry but I reviewed the task a few times, is there any particular reason why you didn't credit me on the issue?
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
over 1 year ago 1:39pm 5 September 2023 - π©πͺGermany Anybody Porta Westfalica
Sorry @dinazaur I missed that. Corrected it now!