How to show custom text in BREADCRUMB/TITLE BAR PANEL in admin panel for a custom module?

I have a module and I have created my own controller to handle edit,create etc like in create method I am doing

function create(){
parent::create();
}

Here when I see the create screen in admin panel it shows Training Material > Create in breadcrumb / title bar panel. How can I inject custom text.

Thanks

Comments

  • edited April 2015
    There is a Fuel_admin::set_titlebar() method that can be used. The fuel/modules/fuel/controllers/module.php file uses this if you are looking for an example. It can be passed a key value array with the key being the URI and the value being the label. If you don't want it hyperlinked, then don't provide a string as the key but instead use an integer.
    $crumbs = array('module/uri' => 'labelgoeshere', 'End of Breadcrumb'); $this->fuel->admin->set_titlebar($crumbs);
    http://docs.getfuelcms.com/libraries/fuel_admin
  • edited 8:10PM
    Here is my class and my url -- http://myproject.local/fuel/mymodule/certs/listing/1, This is listing of all the certificates(child table) under some deal (master table). I have tried solution given by you but it's not working....

    You can see in below class I tried your solution in edit method. Don't know what I am missing.

    class Cert extends Module {
    public $part_id;

    function __construct()
    {
    parent::__construct();
    }

    function index() {
    if(!uri_segment(5) && !ctype_digit(uri_segment(5))){
    show_404();
    }
    $this->items();
    }

    function items() {
    parent::items();
    }


    function edit() {
    if(!uri_segment(5) && !ctype_digit(uri_segment(5))){
    show_404();
    }
    $id = uri_segment(5);
    //$crumbs = array('module_uri' => 'deal/certificates', 'End of Breadcrumb');
    //$this->fuel->admin->set_titlebar($crumbs);
    parent::edit($id);
    $crumbs = array('module_uri' => 'deal/certificates', 'End of Breadcrumb');
    $this->fuel->admin->set_titlebar($crumbs);


    }

    /*public function items(){
    parent::items();
    //echo $this->part_id;
    //echo $this->model->db()->last_query();
    }*/


    public function listing(){

    if(!uri_segment(5) && !ctype_digit(uri_segment(5))){
    show_404();
    }

    $this->items();
    //$this->part_id = $this->uri->get(5);
    //$this->items();
    }
  • edited 8:10PM
    I found the solution :) ..

    Eventually I will have to load view.

    I am loving it....

    (Are you thinking of changing the admin panel to twitter bootstrap themes?)

    $crumbs = array('module/uri' => 'labelgoeshere', 'End of Breadcrumb');
    $this->fuel->admin->set_titlebar($crumbs);
    $this->fuel->admin->render($this->views['create_edit'], $vars, '', FUEL_FOLDER);
  • edited 8:10PM
    But there is an issue in a custom method...
    When I add crumb it shows nothing just a ajax loader....what can be the issue?

    public function listing(){

    if(!uri_segment(5) && !ctype_digit(uri_segment(5))){
    show_404();
    }

    $this->items();
    $crumbs = array('module/uri' => 'labelgoeshere', 'End of Breadcrumb');
    $this->fuel->admin->set_titlebar($crumbs);
    $this->fuel->admin->render($this->views['list'], $vars, '', FUEL_FOLDER);
    }
  • edited 8:10PM
    Is there perhaps a 500 error being returned in the javascript console from an Ajax request to return the list items?
  • edited 8:10PM
    It is returning nothing actually. But with the time constraint I have copied the code from module.php's items method. :). I will look into this later but meanwhile if I can get help from you it would be great.

    Thanks
  • edited 8:10PM
    Is the AJAX response a 200 success response for the fuel/{module}/items?
Sign In or Register to comment.