croogo menu hook

The plugin bootstrapper can add a normal menu just like an admin menu.

All you need to do is add a method to app\libs\croogo.php

    public function hookMenu($pluginName) {
        $pluginName = Inflector::underscore($pluginName);
        Configure::write('Normal.menus.main.'.$pluginName, 1);

Then in app\views\helpers\layout.php, you simply add

//at the end of menu()
        $themeMenu = Configure::read('Normal.menus.' . $menuAlias);
        if ($themeMenu) $output .= $this->_themeMenu($themeMenu);
    function _themeMenu($themeMenu)
      $op = '<ul class="sf-menu">';
      foreach (array_keys($themeMenu) AS $p)
        $op .= '<li>' . $this->View->element('normal_menu', array('plugin' => $p)) . '</li>';
      $op .= '</ul>';
      return $op;

Leave a Comment