Skip to content

dartmoon-io/prestashop-tabmanager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prestashop TabManager

A simple package that allows you to add your controllers to the PrestaShop Backoffice menu. Simply define an array with all the menu items and let the package install them.

Installation

  1. Install the package
composer require dartmoon/prestashop-tabmanager
  1. Define an array called menu_tabs inside the main class of your module
//...
protected $menu_tabs = [
    //
];
//...
  1. Fix install and unistall method of your module
//...
public function install()
{
    if (
        parent::install()
        && TabManager::install($this->menu_tabs, $this)
        // && $this->registerHook(...)
    ) {
        //...

        return true;
    }

    return false;
}

public function uninstall()
{
    //...
    TabManager::uninstallForModule($this);
    return parent::uninstall();
}
//...

Usage

Simply add all the menu items to the menu_tabs array.

protected $menu_tabs = [
    [// This is a parent tab
        'name' => 'Parent tab',
        'class_name' => 'UNIQUE_TAB_NAME',
        'route_name' => '',
        'parent_class_name' => '',
        'icon' => 'settings',
        'visible' => true,
    ],
    [ // This a child of the previus tab
        'name' => 'Child tab',
        'class_name' => 'MySuperClass', // Remember that the controller class name is MySuperClassController, but we need to add it without the suffix "Controller"
        'route_name' => '',
        'parent_class_name' => 'UNIQUE_TAB_NAME',
        'icon' => '',
        'visible' => true,
    ],
];

License

This project is licensed under the MIT License - see the LICENSE.md file for details