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

Diff of /contributions/modules/comment_alter_taxonomy/comment_alter_taxonomy.module

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

revision 1.16, Thu Feb 19 23:58:53 2009 UTC revision 1.17, Tue Mar 24 00:39:32 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: comment_alter_taxonomy.module,v 1.15 2009/02/06 12:40:53 aclight Exp $  // $Id: comment_alter_taxonomy.module,v 1.16 2009/02/19 23:58:53 damz Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 31  function comment_alter_taxonomy_menu($ma Line 31  function comment_alter_taxonomy_menu($ma
31      'page arguments' => array('comment_alter_taxonomy_admin_settings'),      'page arguments' => array('comment_alter_taxonomy_admin_settings'),
32      'access arguments' => array('administer site configuration'),      'access arguments' => array('administer site configuration'),
33    );    );
34      $legacy = variable_get('comment_alter_taxonomy_legacy_issue_paths', FALSE);
35      if (module_exists('project_issue') && !empty($legacy)) {
36        $items['project/issues/%/term/%'] = array(
37          'title' => 'Issues for a project with a given term',
38          'page callback' => 'comment_alter_taxonomy_legacy_project_issue_redirect',
39          'page arguments' => array(4, 2),
40          'access arguments' => array('access content'),
41          'file' => 'comment_alter_taxonomy_legacy_pages.inc',
42        );
43        $items['project/issues-term/%'] = array(
44          'title' => 'Issues with a given term',
45          'page callback' => 'comment_alter_taxonomy_legacy_project_issue_redirect',
46          'page arguments' => array(2),
47          'access arguments' => array('access content'),
48          'file' => 'comment_alter_taxonomy_legacy_pages.inc',
49        );
50      }
51    return $items;    return $items;
52  }  }
53    
54  /**  /**
  * Implementation of hook_views_api().  
  */  
 function comment_alter_taxonomy_views_api() {  
   return array('api' => 2.0);  
 }  
   
 /**  
55   * Administration settings form.   * Administration settings form.
56   */   */
57  function comment_alter_taxonomy_admin_settings() {  function comment_alter_taxonomy_admin_settings() {
# Line 60  function comment_alter_taxonomy_admin_se Line 70  function comment_alter_taxonomy_admin_se
70      '#default_value' => array_filter(variable_get('comment_alter_taxonomy_vocabularies', array())),      '#default_value' => array_filter(variable_get('comment_alter_taxonomy_vocabularies', array())),
71    );    );
72    
73      if (module_exists('project_issue')) {
74        $form['project_issue'] = array(
75          '#type' => 'fieldset',
76          '#title' => t('Project issue support'),
77          '#collapsible' => TRUE,
78          '#collapsed' => TRUE,
79        );
80        $form['project_issue']['comment_alter_taxonomy_legacy_issue_paths'] = array(
81          '#type' => 'checkbox',
82          '#title' => t('Provide support for legacy project issue taxonomy listing paths'),
83          '#default_value' => variable_get('comment_alter_taxonomy_legacy_issue_paths', FALSE),
84        );
85        $form['#submit'][] = 'comment_alter_taxonomy_settings_submit';
86      }
87    
88    return system_settings_form($form);    return system_settings_form($form);
89  }  }
90    
91    function comment_alter_taxonomy_settings_submit($form, $form_state) {
92      $current_value = variable_get('comment_alter_taxonomy_legacy_issue_paths', 'FALSE');
93      $form_value = $form_state['values']['comment_alter_taxonomy_legacy_issue_paths'];
94      if ($current_value != $form_value) {
95        // If the setting changed, record that and force a menu rebuild to ensure
96        // we have the right menu items defined based on the setting.
97        variable_set('comment_alter_taxonomy_legacy_issue_paths', $form_value);
98        menu_rebuild();
99      }
100    }
101    
102  /**  /**
103   * Implementation of hook_form_alter().   * Implementation of hook_form_alter().
104   */   */
# Line 488  function comment_alter_taxonomy_theme() Line 524  function comment_alter_taxonomy_theme()
524   */   */
525  function theme_comment_alter_taxonomy_project_issue_metadata_term($node, $term) {  function theme_comment_alter_taxonomy_project_issue_metadata_term($node, $term) {
526    if (isset($term->tid)) {    if (isset($term->tid)) {
527        $link_options = array();
528      if (module_exists('project_issue') && $node->type == 'project_issue') {      if (module_exists('project_issue') && $node->type == 'project_issue') {
529        $path = 'project/issues/'. $node->project_issue['pid'] .'/term/'. $term->tid;        $project = node_load($node->project_issue['pid']);
530          $vocabulary = taxonomy_vocabulary_load($term->vid);
531          $identifier = project_issue_views_filter_identifier($vocabulary->name);
532          $path = 'project/issues/search/'. $project->project['uri'];
533          $link_options['query'] = array($identifier => $term->name);
534      }      }
535      else {      else {
536        $path = taxonomy_term_path($term);        $path = taxonomy_term_path($term);
537      }      }
538      return l($term->name, $path);      return l($term->name, $path, $link_options);
539    }    }
540    else {    else {
541      // New free tagging terms won't yet have a tid in the node preview mode      // New free tagging terms won't yet have a tid in the node preview mode

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.2