Skip to content
This repository has been archived by the owner on Nov 24, 2019. It is now read-only.

v1 Generate module's auto navbar for admin page

vee w, edited this page Jan 31, 2014 · 1 revision

Before start this section, please follow this link to understand module folder structure.

https://github.com/ve3/fuel-start/wiki/v1-Permission-in-admin-controller#wiki-module-controller

To create mdules's auto navbar for admin page, follow these instruction.

Open your <module_name>admin.php file

From this example, your module name is blog.

Example:

namespace Blog;

class BlogAdmin 
{
    public function __construct() 
    {
        // load language
        \Lang::load('blog::blog');// this is load language in module style, and this load language will be used in auto gen navbar for admin page.
    }// __construct


    public function admin_navbar() 
    {
        return '<li>
            <a href="#" onclick="return false;">' . \Lang::get('blog') . '</a>
            <ul>
                <li>' . \Extension\Html::anchor('blog/admin', \Lang::get('blog_manage')) . '</li>
                <li>' . \Extension\Html::anchor('blog/admin/comment', \Lang::get('blog_manage_comment')) . '</li>
            </ul>
        </li>';
    }
}

The admin_navbar method is required to generate auto navbar for admin page.

Now, go to your admin dashboard and refresh/reload the page. Mouse hover the Components menu and you will see your module's navbar show up there.

If you don't want auto generate navbar for admin page, you do not need admin_navbar method in this class.