/[drupal]/contributions/modules/flag/flag.module
ViewVC logotype

Diff of /contributions/modules/flag/flag.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.11.2.72.2.23, Thu Oct 29 05:06:11 2009 UTC revision 1.11.2.72.2.24, Mon Nov 2 06:17:01 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: flag.module,v 1.11.2.72.2.22 2009/10/28 02:38:10 quicksketch Exp $  // $Id: flag.module,v 1.11.2.72.2.23 2009/10/29 05:06:11 quicksketch Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 531  function flag_node_type($op, $info) { Line 531  function flag_node_type($op, $info) {
531  }  }
532    
533  /**  /**
534     * Implementation of hook_activity_info().
535     */
536    function flag_activity_info() {
537      $info = new stdClass();
538      $info->api = 2;
539      $info->name = 'flag';
540      // The order of objects here matters. If a user is both the author and the
541      // flagging user, the flagging user message takes precedence.
542      $info->objects = array('node author' => 'node', 'flagging user' => 'account', 'comment author' => 'comment');
543      $info->hooks = array('flag' => array('flag', 'unflag'));
544    
545      // Figure out the activity access control realms and the types.
546      $flags = flag_get_flags();
547      foreach ($flags as $fid => $flag) {
548        $info->realms["flag_" . $flag->fid] = $flag->title;
549        // Currently, flagging a user cannot be recorded.
550        if ($flag->content_type != 'user') {
551          $info->type_options[$flag->fid] = $flag->title;
552        }
553      }
554      $info->object_type = 'flag';
555      $info->path = drupal_get_path('module', 'flag') . '/includes';
556      return $info;
557    }
558    
559    /**
560   * Menu callback for (un)flagging a node.   * Menu callback for (un)flagging a node.
561   *   *
562   * Used both for the regular callback as well as the JS version.   * Used both for the regular callback as well as the JS version.
# Line 654  function flag($action, $flag_name, $cont Line 680  function flag($action, $flag_name, $cont
680   */   */
681  function flag_flag($action, $flag, $content_id, $account) {  function flag_flag($action, $flag, $content_id, $account) {
682    if (module_exists('trigger')) {    if (module_exists('trigger')) {
683      $flag_action = $flag->get_flag_action($content_id);      $context['hook'] = 'flag';
684      $flag_action->action = $action;      $context['account'] = $account;
685      $context = (array)$flag_action;      $context['flag'] = $flag;
686        $context['op'] = $action;
687    
688        // We add to the $context all the objects we know about:
689        $context = array_merge($flag->get_relevant_action_objects($content_id), $context);
690    
691      // Generic "all flags" actions.      // Generic "all flags" actions.
692      foreach (_trigger_get_hook_aids($action, $action) as $aid => $action_info) {      foreach (_trigger_get_hook_aids($action, $action) as $aid => $action_info) {
693        // The 'if ($aid)' is a safeguard against http://drupal.org/node/271460#comment-886564        // The 'if ($aid)' is a safeguard against http://drupal.org/node/271460#comment-886564

Legend:
Removed from v.1.11.2.72.2.23  
changed lines
  Added in v.1.11.2.72.2.24

  ViewVC Help
Powered by ViewVC 1.1.2