This project is not covered by Drupal’s security advisory policy.

This simple module allows you configure to display notifications for menu items. This is useful when you need to indicate new changes for a user on the site.

Features:

  • Support tokens and menu_token module (D7);
  • Possibility to sum numeric result;
  • Adding a prefix;
  • Showing several types of notifications. Default available one;
  • Create new types of notifications with their own properties.

Defining a new type of notification:

/**
 * Implements hook_menu_notifications_info().
 */
function mymodule_menu_notifications_info() {
  $info = array();

  $info['new_type'] = array(
    '#title' => t('My new notification'),
    'property1' => array(
      'label' => t('My property 1'),
      'description' => t('My description for property 1.'),
      'default' => '',
    ),
    'property2' => array(
      'label' => t('My property 2'),
      'description' => t('My description for property 2.'),
      'default' => '',
    ),
    // etc...
  );

  return $info;
}

/**
 * Implements hook_menu_notifications_handler().
 */
function mymodule_menu_notifications_handler(&$title, $data) {
  // Code.
  if ($data['type'] == 'new_type') {
    $title .= '<span class="notification-new_type ' . $data['info']['property1'] . '">' . $data['info']['property2'] . '</span>';
  }
}

Project information

Releases