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

Diff of /contributions/modules/article/article.module

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

revision 1.23.2.5.2.1.2.13.2.4, Sat Aug 29 09:49:10 2009 UTC revision 1.23.2.5.2.1.2.13.2.5, Sat Aug 29 09:58:41 2009 UTC
# Line 1  Line 1 
1  <?php // -*-php-*-  <?php // -*-php-*-
2  // $Id: article.module,v 1.23.2.5.2.1.2.13.2.3 2009/01/01 19:07:42 msameer Exp $  // $Id: article.module,v 1.23.2.5.2.1.2.13.2.4 2009/08/29 09:49:10 msameer Exp $
3    
4  /**  /**
5    Article Module - an easy to use integrated article management module.    Article Module - an easy to use integrated article management module.
# Line 180  function article_admin_settings() { Line 180  function article_admin_settings() {
180                                      '#description' => t('Use the pathauto module to create links to article categories.')                                      '#description' => t('Use the pathauto module to create links to article categories.')
181  );  );
182    
183      $form['article_replace_taxonomy_links'] = array(
184          '#type' => 'checkbox',
185          '#title' => t('Replace taxonomy links to point to article based path'),
186          '#default_value' => variable_get('article_replace_taxonomy_links', false),
187          '#description' => t('When viewing a node, the category link will link back to taxonomy. Mark this checkbox if you want to the links to point to article again.')
188      );
189    
190    return system_settings_form($form);    return system_settings_form($form);
191  }  }
192    
# Line 432  function article_build_breadcrumbs($tid) Line 439  function article_build_breadcrumbs($tid)
439    return $term;    return $term;
440  }  }
441    
442    /**
443     * Implementation of hook_link();
444     * Replace current taxonomy link with article path
445     */
446    function article_link_alter(&$links, $node) {
447        //Only process if the option is enabled
448        if (!variable_get('article_replace_taxonomy_links', false)) {
449            return;
450        }
451    
452        //Get current article terms
453        $terms = article_get_article_terms();
454        foreach ($links as $module => $link) {
455            if (strstr($module, 'taxonomy_term')) {
456                //Check if taxonomy term is included in the article vocabularies
457                $tid = str_replace('taxonomy/term/', '', $link['href']);
458                if (in_array($tid, $terms)) {
459                    //Change current link to the article path
460                    $links[$module]['href'] = 'article/'. $tid;
461                }
462            }
463        }
464    }
465    
466  /**  @} End of the module_article group **/  /**  @} End of the module_article group **/
467    
468    

Legend:
Removed from v.1.23.2.5.2.1.2.13.2.4  
changed lines
  Added in v.1.23.2.5.2.1.2.13.2.5

  ViewVC Help
Powered by ViewVC 1.1.2