Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Where modifier not working in partial with dynamic key #2538

Open
hmalaud opened this issue May 16, 2021 · 0 comments
Open

Where modifier not working in partial with dynamic key #2538

hmalaud opened this issue May 16, 2021 · 0 comments

Comments

@hmalaud
Copy link

hmalaud commented May 16, 2021

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Create globals set with array of objects:

dev.yaml -->
data:
  full_images:
    - image_width: 1920
      media_query: "(orientation: landscape) and (min-width: 1920px)"
      default_size: false
      type: size
      is_portrait: false
      enabled: true
    - image_width: 1920
      media_query: "(orientation: landscape) and (min-width: 1600px)"
      default_size: false
      type: size
      is_portrait: false
      enabled: true
    - image_width: 1440
      media_query: "(orientation: landscape) and (min-width: 1440px)"
      default_size: false
      type: size
      is_portrait: false
      enabled: true
    - image_width: 1280
      media_query: "(orientation: landscape) and (min-width: 1280px)"
      default_size: true
      type: size
      is_portrait: false
      enabled: true
    - image_width: 1152
      image_height: 2050
      media_query: "(orientation: portrait) and (min-width: 1152px)"
      default_size: false
      type: size
      is_portrait: false
      enabled: true
    - image_width: 580
      image_height: 1000
      media_query: "(orientation: portrait)"
      default_size: false
      type: size
      is_portrait: false
      enabled: true

Loop in partial

my_partial.antlers.html -->
   {{ dev:full_images }}
      Working fine!
   {{ /dev:full_images }}

Add modifier:

   {{ dev:full_images where="default_size:1" }}
      Only one output: still working fine!
   {{ /dev:full_images }}

(Don't know if that's another bug but using with group_by throws an error array_key_exists(): Argument #1 ($key) must be a valid array offset type, but that's not why I'm here for)

Use dynamic key as a parameter on the partial call

      {{ partial:partials/picture gset="full_images" }}

Loop in partial

   {{ dev[gset] }}
      Still working fine!
   {{ /dev[gset] }}

Add modifier:

   {{ dev[gset] where="default_size:1" }}
      No output, not working anymore
   {{ /dev[gset] }}

Expected behavior
Expects behavior to be the same with dynamic key value or static variable name.

Environment details (please complete the following information):

  • Statamic Version 3.1.14
  • Fresh Install or Upgrade: Fresh install
  • OS: Mac Big Sur 11.3
  • Browser: Chrome 90.0.4430.212
  • Web Server: Apache
  • PHP Version: 8.0.2
  • Addons installed: codedge/statamic-move-entries 1.1, edalzell/variable 1.0.4
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant