Defining categories, optionally with icons

Last updated on
30 November 2019

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Since Rules 2.4 the API allows you to define categories instead of (or in addition to) the regular 'group' key of actions/conditions. As of now, Rules 7.x does not make use of this icons, but other UIs may do - e.g. the UI of fluxkraft does. Still, defining a category might be useful for more than providing an icon, i.e. you can use it to weight the ordering of categories as they appear in drop down lists as used by the Rules module:

/**
 * Implements hook_rules_category_info().
 */
function module_rules_category_info() {
  return array(
    'rules_components' => array(
      'label' => t('Components'),
      'equals group' => t('Components'),
      'weight' => 50,
    ),
  );
}

For best compatibility modules may keep using the 'group' key for referring to categories - that's why 'equals group' allows you to denote the relationship.

Please see hook_rules_category_info() for complete API docs. Also, as Rules and fluxservice icons follow the same rules, you can refer to the fluxservice documentation for creating icons, but provide it via hook_rules_category_info() instead.

Help improve this page

Page status: No known problems

You can: