You are here

function scald_scald_actions_alter in Scald: Media Management made easy 7

Implements hook_scald_actions_alter().

Assigns each actions an unique bitmask.

File

./scald.module, line 197
The Scald Core, which handles all Scald Registries and dispatch.

Code

function scald_scald_actions_alter(&$actions) {
  $powers = variable_get('scald_actions_powers', array());
  $max_power = empty($powers) ? 0 : max($powers) + 1;
  $new_power = FALSE;
  foreach ($actions as $name => $action) {
    if (!isset($powers[$name])) {
      $new_power = TRUE;
      $powers[$name] = $max_power++;
    }
    $actions[$name]['bitmask'] = pow(2, $powers[$name]);
  }
  if ($new_power) {
    variable_set('scald_actions_powers', $powers);
  }
}