Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior when using custom nav field conditions based on depth #11379

Open
robdekort opened this issue Jan 22, 2025 · 0 comments
Open

Comments

@robdekort
Copy link
Contributor

Bug description

Possibly related to #11359?

In a nav blueprint, the following condition using < 2 works. The field is only visible on level 1:

tabs:
  main:
    display: Main
    sections:
      -
        display: General
      -
        display: Styling
        fields:
          -
            handle: render_as_button
            field:
              type: toggle
              display: 'Render as button'
              if:
                depth: '< 2'

The following condition using equals 1 doesn't work. The field is not visible on any level:

tabs:
  main:
    display: Main
    sections:
      -
        display: General
      -
        display: Styling
        fields:
          -
            handle: render_as_button
            field:
              type: toggle
              display: 'Render as button'
              if:
                depth: 'equals 1'

When we don't use a section, either of these blueprints and conditions will work as expected:

tabs:
  main:
    display: Main
    sections:
      -
        display: General
        fields:
          -
            handle: render_as_button
            field:
              type: toggle
              display: 'Render as button'
              if:
                depth: '< 2'
tabs:
  main:
    display: Main
    sections:
      -
        display: General
        fields:
          -
            handle: render_as_button
            field:
              type: toggle
              display: 'Render as button'
              if:
                depth: 'equals 1'

How to reproduce

Play with the blueprints above.

Logs

Environment

Environment
Application Name: De Kinderacademie
Laravel Version: 11.38.2
PHP Version: 8.2.27
Composer Version: 2.8.4
Environment: local
Debug Mode: ENABLED
URL: dekinderacademie.test
Maintenance Mode: OFF
Timezone: Europe/Amsterdam
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 4
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.45.2 PRO

Statamic Addons
studio1902/statamic-peak-browser-appearance: 3.6.0
studio1902/statamic-peak-commands: 8.15.1
studio1902/statamic-peak-seo: 8.19.0
studio1902/statamic-peak-tools: 6.7.1

Installation

Starter Kit using via CLI

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant