You are here

function rules_get_title in Rules 7.2

Menu callback for getting the title as configured.

See also

RulesUIController::config_menu()

3 string references to 'rules_get_title'
hook_rules_ui_menu_alter in ./rules.api.php
Allows modules to alter or to extend the provided Rules UI.
RulesUIController::config_menu in ui/ui.controller.inc
Generates menu items to manipulate rules configurations.
rules_scheduler_rules_ui_menu_alter in rules_scheduler/rules_scheduler.module
Implements hook_rules_ui_menu_alter().

File

./rules.module, line 1323
Rules engine module.

Code

function rules_get_title($text, $element) {
  if ($element instanceof RulesPlugin) {
    $cache = rules_get_cache();
    $plugin = $element
      ->plugin();
    $plugin = isset($cache['plugin_info'][$plugin]['label']) ? $cache['plugin_info'][$plugin]['label'] : $plugin;
    $plugin = drupal_strtolower(drupal_substr($plugin, 0, 1)) . drupal_substr($plugin, 1);
    return t($text, array(
      '!label' => $element
        ->label(),
      '!plugin' => $plugin,
    ));
  }

  // As fallback treat $element as simple string.
  return t($text, array(
    '!plugin' => $element,
  ));
}