0

I'm trying to achieve a structure like this in a yml:

$admin_menu_items = array(
    array(
        "label" => "thisisalabel"
        "sub_menu_items" => array(
             array("label" => "anotherlabel", "route" => "routename"),
             array("label" => "thirdlabel", "route" => "anotherroutename")
        )
    )
);

So far i've tried this without success:

admin_menu_items:
    - { label: "thisisalabel", sub_menu_items:
        - { label: "anotherlabel", route: "routename" }
        - { label: "thirdlabel", route: "anotherroutename" }
    }

Can you guys please help me figuring out the right way for doing this?

Finally i've used a sollution based on Qoop's answers. Here it is:

admin_menu_items:
    -
        label: "thisisalabel"
        sub_menu_items:
            - { label: "anotherlabel", route: "routename" }
            - { label: "thirdlabel", route: "anotherroutename" }
2
  • I don't understand the language that the first block of code is written in, but it says "array" five times. I sort of expected, but don't see five ordered lists in the YAML. Do the 2nd, 4th, and 5th "array"s generate unordered hashes, or ordered lists of key-value pairs? Commented Jul 18, 2014 at 2:06
  • Also, if $admin_menu_items represent a variable name rather than the key in a hash table, then the first line may not belong in the YAML. Commented Jul 18, 2014 at 2:15

1 Answer 1

1

I think this might do it..

admin_menu_items:
    -
        label: "thisisalabel"
        sub_menu_items:
            -
                label: "anotherlabel"
                route: "routename"
            -
                label: "thirdlabel"
                route: "anotherroutename"
Sign up to request clarification or add additional context in comments.

1 Comment

Finally i've used a sollution similar and based on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.