# Admin Toolbar

![Admin Toolbar](/files/-LsgK6ytBT-OdMfqv8XS)

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)

```php
 AdminToolbar::newInstance()->add_menu( array(...) );
```

```php
 /**
   * 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

```php
 /**
  * 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'
             ) );
 }
```

```php
 osc_add_hook( 'add_admin_toolbar_menus', 'osc_admin_toolbar_menu'    , 0 );
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mindstellar.com/osclass-docs/developers/plugins-themes/admin-toolbar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
