Using ActionBar

ActionBar is a module that renders a row of buttons at the top of the screen. To add a button, call:

Base_ActionBarCommon::add($icon, $label, $action);

Note: add() is a static call, so you're not creating a module instance — but you still need to mark Base/ActionBar as a required module for your own module.

The $icon argument picks which icon ActionBar uses for the button. Epesi's default theme currently ships these icons:

  • home
  • back
  • report
  • calendar
  • search
  • folder
  • new
  • edit
  • view
  • add
  • delete
  • save
  • settings
  • print

The $label argument is the text shown on the button, and $action is what happens when it's clicked. The simplest way to build an action is with one of the create_href family of functions.

For example, to add a button that calls the module method delete_entry, using the delete icon and the label "Delete":

Base_ActionBarCommon::add('delete', $lang->ht('Delete'), $this->create_callback_href(array($this, 'delete_entry'), $id));

$lang is an instance of the Base/Lang module. Button labels should use hidden translation.