Checking the setting "Load PhotoSwipe on all non-admin pages" will load Photoswipe on admin pages only.

if (\Drupal::config('photoswipe.settings')->get('photoswipe_always_load_non_admin') && $is_admin) {}

Shouldn't it be an OR instead of an AND?

Comments

fabian.marz created an issue. See original summary.

fabian.marz’s picture

StatusFileSize
new612 bytes
fabian.marz’s picture

agoradesign’s picture

Don't think that an OR is correct because it will fix non admin pages of course but on the other side will load it also on admin pages, which wouldn't make sense to me.

I believe the correct solution is to negate the $is_admin:

if (\Drupal::config('photoswipe.settings')->get('photoswipe_always_load_non_admin') && $!is_admin)

workplaysleep’s picture

StatusFileSize
new612 bytes

@agoradesign correct, and the new patch (so an can refer from my composer.json) a new dev release with multiple patches would do no harm

fabian.marz’s picture

Ok. I didn't know if was the intention to load the script on admin as well. But you're right. Doesn't make much sense to me neither. Thanks for adding a new patch!

  • sun committed 8b371c5 on 8.x-1.x authored by workplaysleep
    Issue #2921487 by fabian.marz, workplaysleep, agoradesign: Fixed option...
sun’s picture

Title: Load PhotoSwipe on all non-admin pages » Option "Always load PhotoSwipe on all non-admin pages" does the opposite
Status: Active » Fixed

Thanks for reporting, testing, and contributing! Committed to 8.x-1.x.

Status: Fixed » Closed (fixed)

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