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

Comments

@TimOetting
Copy link

@TimOetting TimOetting commented Feb 18, 2020

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

This comment has been minimized.

Copy link
Contributor

@afbora 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

This comment has been minimized.

Copy link
Contributor

@afbora 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

This comment has been minimized.

Copy link
Contributor

@distantnative distantnative commented Feb 18, 2020

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 mentioned this issue Feb 18, 2020
4 of 4 tasks complete
@afbora afbora linked a pull request that will close this issue Feb 18, 2020
4 of 4 tasks complete
afbora added a commit that referenced this issue Feb 20, 2020
bastianallgeier added a commit that referenced this issue Mar 5, 2020
bastianallgeier added a commit that referenced this issue Mar 5, 2020
@bastianallgeier

This comment has been minimized.

Copy link
Contributor

@bastianallgeier bastianallgeier commented Mar 5, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants
You can’t perform that action at this time.