You are here

function sms_actions_action_info_alter in SMS Framework 7

Same name and namespace in other branches
  1. 6.2 modules/sms_actions/sms_actions.module \sms_actions_action_info_alter()
  2. 6 modules/sms_actions/sms_actions.module \sms_actions_action_info_alter()

Implements hook_action_info_alter().

File

modules/sms_actions/sms_actions.module, line 278
Provides a "Send SMS" action and the ability to define custom triggers for incoming messages.

Code

function sms_actions_action_info_alter(&$actions) {

  // Actions to alter.
  $hooks = array(
    'node_publish_action',
    'node_unpublish_action',
    'node_make_sticky_action',
    'node_make_unsticky_action',
    'node_promote_action',
    'node_unpromote_action',
    'node_assign_owner_action',
    'node_save_action',
    'node_unpublish_by_keyword_action',
    'system_send_email_action',
    'sms_actions_send_action',
  );
  $commands = sms_actions_get_commands();
  $command_triggers[] = 'sms_actions';
  foreach ($commands as $command) {
    $command_triggers[] = $command->hook;
  }
  foreach ($actions as $hook => $action) {
    if (in_array($hook, $hooks) && $action['triggers'] != array(
      'any',
    )) {
      $actions[$hook]['triggers'] = array_unique(array_merge($actions[$hook]['triggers'], $command_triggers));
    }
  }
}