function action_function_lookup

Returns an action array key (function or ID), given its hash.

Faster than action_actions_map() when you only need the function name or ID.

Parameters

$hash: Hash of a function name or action ID array key. The array key is a key into the return value of action_list() (array key is the action function name) or action_get_all_actions() (array key is the action ID).

Return value

The corresponding array key, or FALSE if no match is found.

2 calls to action_function_lookup()
action_admin_configure_submit in drupal/core/modules/action/action.admin.inc
Form submission handler for action_admin_configure().
action_admin_configure_validate in drupal/core/modules/action/action.admin.inc
Form validation handler for action_admin_configure().

File

drupal/core/modules/action/action.module, line 323
This is the Actions module for executing stored actions.

Code

function action_function_lookup($hash) {

  // Check for a function name match.
  $actions_list = action_list();
  foreach ($actions_list as $function => $array) {
    if (drupal_hash_base64($function) == $hash) {
      return $function;
    }
  }
  $aid = FALSE;

  // Must be a configurable action; check database.
  $result = db_query("SELECT aid FROM {actions} WHERE parameters <> ''")
    ->fetchAll(PDO::FETCH_ASSOC);
  foreach ($result as $row) {
    if (drupal_hash_base64($row['aid']) == $hash) {
      $aid = $row['aid'];
      break;
    }
  }
  return $aid;
}