Osclass Documentation
Download OslcassCodeIssuesSupport Forum
v3.9.0
v3.9.0
  • Osclass
  • Beginners
    • Install
    • Updating Osclass
    • Osclass Cron
  • Configuring Osclass
    • Mail Server
    • Installing Locations
    • Increase PHP memory limit
    • Improving Search
    • Configure Cache
  • Developers
    • Basic Osclass
      • Contribute to Osclass
      • Coding Style
      • Debug PHP Errors
      • Debug SQL Queries
      • How to write a bug report
      • Database model and diagram
    • Plugins and Themes
      • Auto-update themes and plugins
      • Administrator Menus
      • Admin Toolbar
      • Style and scripts enqueue functions
      • Routes
  • Legacy Installations Pre 3.8.0
    • Introduction
    • Remove calls to Osclass
      • Delete featured products from Admin.
      • Stop auto upgrading.
      • Stop checking for updates from Osclass.
      • Disable Upgrade page
    • Remove Market from admin frontend
      • Delete Market from Admin menu.
      • Delete Market from Plugins.
      • Delete Market from Appearance (themes).
      • Delete Connect Market from Admin toolbar.
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Developers
  2. Plugins and Themes

Admin Toolbar

PreviousAdministrator MenusNextStyle and scripts enqueue functions

Last updated 5 years ago

Was this helpful?

At admin panel since osclass version 3.0, there is a toolbar which is visible around the admin panel, can have shortcuts to actions like: add a new listing, show pending updates, ...

Developers can add to the toolbar whatever they want, with hooks, and calling AdminToolbar functions like add_menu($array)

 AdminToolbar::newInstance()->add_menu( array(...) );
 /**
   * Add a node to the menu.
   *   
   * @todo implement parent nodes
   *
   * @param array $args - The arguments for each node.
   * - id         - string    - The ID of the item.
   * - title      - string    - The title of the node.
   * - href       - string    - The link for the item. Optional.
   * - meta       - array     - Meta data including the following keys: html, class, 
   *                                 onclick, target, title, tabindex.
 */
 function add_menu( $array ) 

Example, adding link to frontend

 /**
  * Add webtitle with link to frontend 
  */
 function osc_admin_toolbar_menu()
 {
     AdminToolbar::newInstance()->add_menu( array(
                 'id'        => 'home',
                 'title'     => ''.  osc_page_title() .'',
                 'href'      => osc_base_url(),
                 'meta'      => array('class' => 'user-profile'),
                 'target'    => '_blank'
             ) );
 }
 osc_add_hook( 'add_admin_toolbar_menus', 'osc_admin_toolbar_menu'    , 0 );
Admin Toolbar