Created
July 19, 2012 10:26
-
-
Save enko/3142905 to your computer and use it in GitHub Desktop.
Menu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Actions { | |
| public function doStuff() { | |
| } | |
| } | |
| class Menu { | |
| var items = array(); // contains MenuItems or Menu (SubMenus!) | |
| } | |
| class MenuItem { | |
| var $menu = null; | |
| var $action = null; // callback | |
| function __construct(Menu $menu) { | |
| $this->menu = $menu; | |
| } | |
| } | |
| $action = new Actions() | |
| $menu = new Menu(); | |
| $mi = new MenuItem($menu); | |
| $mi->action = $action->doStuff; | |
| $foo->items[] = $mi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment