menu icon indicating copy to clipboard operation
menu copied to clipboard

How to build menu from multi dimension array?

Open settysantu opened this issue 2 years ago • 0 comments

I'm struggling to build a menu for this below array

$menu_items = Array(
    0 => Array(
      "id" => 1,
      "text" => "Home",
      "href" => "#home",
      "columns" => 0
    ),
    1 => Array(
      "id" => 2,
      "text" => "About",
      "href" => "#",
      "columns" => 0,
      "children" => Array(
        0 => Array(
          "id" => 3,
          "text" => "Menu Item 1",
          "href" => "#",
        ),
        1 => Array(
          "id" => 4,
          "text" => "Menu Item 2",
          "href" => "#",
        )
      )
    ),
    2 => Array(
      "id" => 5,
      "text" => "Something else here",
      "href" => "#",
      "columns" => 0
    ),
  );

settysantu avatar Aug 03 '22 12:08 settysantu