No actions available for my custom Drupal trigger -
i writing drupal module (filemaker) , defined custom triggers. triggers show fine, 'no available actions trigger.' @ admin/build/trigger/filemaker.
any idea how make actions available trigger?
thanks in advance.
/** * implementation of hook_hook_info(). */ function filemaker_hook_info() { return array( 'filemaker' => array( 'filemaker' => array( 'create' => array( 'runs when' => t('after creating filemaker record'), ), 'update' => array( 'runs when' => t('after updating filemaker record'), ), ), ), ); } /** * implementation of hook_filemaker(). */ function filemaker_filemaker($op, $node) { $aids = _trigger_get_hook_aids('filemaker', $op); $context = array( 'hook' => 'filemaker', 'op' => $op, 'node' => $node, ); actions_do(array_keys($aids), $node, $context); } [...] // fire off hook. module_invoke_all('filemaker', 'create', $node); [...]
got it. found answer here.
needed hook_action_info_alter().
/** * implementation of hook_action_info_alter(). */ function filemaker_action_info_alter(&$info) { // loop through each action. foreach ($info $type => $data) { // add our trigger node or system actions. if (stripos($type, "node_") === 0 || stripos($type, "system_") === 0) { // don't remove triggers added approved list. if (isset($info[$type]['hooks']['application'])) { $info[$type]['hooks']['filemaker'] = array_merge($info[$type]['hooks']['filemaker'], array('create', 'update')); } // add our trigger approved list of hooks. else { $info[$type]['hooks']['filemaker'] = array('create', 'update'); } } } }
Comments
Post a Comment