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

Query syntax in blueprints ignores nested config variable when key contains a number #2462

Closed
TimOetting opened this issue Feb 18, 2020 · 4 comments · Fixed by #2465
Closed
Assignees
Labels
type: enhancement ✨ Suggests an enhancement; improves Kirby
Milestone

Comments

@TimOetting
Copy link

Describe the bug
From within my blueprint I would like to access a variable from a config array for a label. This does not work, if the array key contains a number. It then simply shows nothing as a label.

To Reproduce
Given the following config.php:

return [
    'places' => [
        "place1" => [
            'name' => 'Place 1'
        ],
        "placeTwo" => [
            'name' => 'Place 2'
        ]
    ]
]

the blueprint

title: My Places
fields:
  text:
    type: text
    label: "{{kirby.option("places").place1.name}}"

does not show anything as a label.

label: "{{kirby.option("places").placeTwo.name}}", however, would work.

Kirby Version
3.3.4

@afbora
Copy link
Member

afbora commented Feb 18, 2020

I can reproduce the issue, i'll track down. As workaround, you can use option key directly like that:

kirby.option("places.place1.name")

@afbora
Copy link
Member

afbora commented Feb 18, 2020

I found the issue. The query parts doesn't support any numbers. We need to ask @distantnative who refactor the code why doesn't support it. Btw works great when implemented as a-zA-Z0-9.

Related Query Class
https://github.com/getkirby/kirby/blob/3.3.4/src/Toolkit/Query.php#L18

@distantnative
Copy link
Member

Maybe I just didn't imagine numbers as part of it....
Could be an easy fix as @afbora suggested. We would nee to run some tests.

afbora added a commit that referenced this issue Feb 18, 2020
@afbora afbora self-assigned this Feb 18, 2020
@afbora afbora added this to the 3.3.5 milestone Feb 18, 2020
@afbora afbora linked a pull request Feb 18, 2020 that will close this issue
4 tasks
@lukasbestle lukasbestle added type: enhancement ✨ Suggests an enhancement; improves Kirby and removed type: bug 🐛 Is a bug; fixes a bug labels Feb 22, 2020
bastianallgeier pushed a commit that referenced this issue Mar 5, 2020
@bastianallgeier
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement ✨ Suggests an enhancement; improves Kirby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants