Skip to content

parser key grouping - question #1206

Open
@petschki

Description

@petschki

We have a pattern with the following arguments:

parser.addArgument("recently-used");
parser.addArgument("recently-used-key");
parser.addArgument("recently-used-max-items", 20);

with the following markup

<div class="pat-contentbrowser" data-pat-contentbrowser='{
    "recentlyUsed": true,
    "recentlyUsedKey": "my_field_key"
    "recentlyUsedMaxItems": 10
}'></div>

what I expect:

you get the parsed options like this:

{
    "recentlyUsed": true,
    "recentlyUsedKey": "my_field_key",
    "recentlyUsedMaxItems": 10
}

what you get

there's the new "group" key recently which holds the default value:

{
    "recentlyUsed": true,
    "recentlyUsedKey": "my_field_key",
    "recentlyUsedKeyMaxItems": 10,
    "recently": {
        "used-max-items": 20
    }
}

now this gets a bit confusing because If we remove an option from the markup (for example the recentlyUsedMaxItems), I expect the this.options.recentlyUsedMaxItems contains the default value from the parser but its missing completely in the dict:

{
    "recentlyUsed": true,
    "recentlyUsedKey": "my_field_key",
    "recently": {
        "used-max-items": 20
    }
}

Only the grouped recently key contains this value.

Further if you remove the default value in parser.addArgument there is no more grouping of the keys at all.

Am I missing some logic here, or is this a bug?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions