On this page
Application Toolbar API and Theming
Last updated on
30 April 2025
The Application Toolbar (Appbar) module provides an API to make extending the Appbar as easy as possible. This page is for the 2.x branch.
Because blocks can be added to the Appbar, all you have to do to add something to the Appbar is implement hook_block().
Hooks
- hook_appbar_css()
-
Allows modules to add new Appbar styles or override existing ones. Individual sites could also just drop CSS files into the "appbar" subdirectory of the default files directory (if it doesn't exist, you can create it) and the module will automatically find them. Should return an array keyed by the location of the CSS file; the values should be the display name of the style.
function example_appbar_css() { $blue_path = drupal_get_path('module', 'appbar') .'/blue.appbar.css'; $dark_path = drupal_get_path('module', 'appbar') .'/dark.appbar.css'; return array( $blue_path => t('Blue (@path)', array('@path' => $blue_path)), $dark_path => t('Dark (@path)', array('@path' => $dark_path)), ); }
Alters
- hook_appbar_message_alter($object)
- Allows modules to react before a new alert is saved into the database. $object is an alert object with properties created, message, is_new, and uid.
API
- appbar_set_message($message, $uid = NULL)
- Allows setting an alert. $message is the text of the alert and $uid is the User ID of the user to whom the alert will be shown. If $uid is NULL, the current user will be used. If $uid is 'all', the alert will be shown to all users. This function is not recommended since Administrators will not be able to control whether alerts set this way are enabled. Instead, alerts should be set using Rules (preferred) or Trigger.
- appbar_get_messages($get_new_count = FALSE)
- If $get_new_count is FALSE, retrieves an array of alert objects. If $get_new_count is TRUE, returns the number of new alerts.
Theme Functions
- theme('appbar_alerts')
- Themes the area where the new message count appears.
- theme('appbar_alerts_list')
- Themes the list of alerts.
- theme('appbar_bar', $check_vis = TRUE)
- Themes the entire Appbar. If $check_vis is TRUE, returns an empty string if the Appbar is not allowed to be shown on that page. If $check_vis is FALSE, the HTML for the Appbar will be returned even if the visibility settings do not allow the Appbar to appear on that page.
- theme('appbar_time', $status_time)
- Themes the display of the time for the alert listing.
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion