I am trying to build a simple URL router that loads predefined urls and settings into an array. Then I need to push it all to a function with a static variable so I can store all the urls and settings in a uniform way.
The array looks like:
Array
(
[index] => Array
(
[#title] => Home
[#access] => user_access
[#callback] => page_index
)
[admin/dashboard] => Array
(
[#title] => Dashboard
[#access_callback] => user_access
[#page_callback] => page_dashboard
)
[admin/stats]
Then I want to push the data from the array into a function:
route('path/path', #callback, #title, #access);
I am trying to build the foreach loops but I can't get passed this mess:
foreach($routes as $path => $array) {
foreach($array as $key => $value) {
}
route($path, );
}
I feel like I am approaching this the wrong way. Any help would be helpful. Thanks