You are here

public static function RulesUICategory::getCategory in Rules 7.2

Gets the category for the given item info array.

Parameters

array $item_info: The info-array of an item, e.g. an entry of hook_rules_action_info().

string|null $key: (optional) The key of the category info to return, e.g. 'label'. If none is given the whole info array is returned.

Return value

array|mixed|false Either the whole category info array or the value of the given key. If no category can be found, FALSE is returned.

1 call to RulesUICategory::getCategory()
RulesUICategory::getItemGroup in ui/ui.core.inc
Returns a group label, e.g. as usable for opt-groups in a select list.

File

ui/ui.core.inc, line 1288
Contains core Rules UI functions.

Class

RulesUICategory
Class holding category related methods.

Code

public static function getCategory($item_info, $key = NULL) {
  if (isset($item_info['category'])) {
    $info = self::getInfo($item_info['category']);
    return isset($key) ? $info[$key] : $info;
  }
  return FALSE;
}