# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: contributions/modules/article/article.module --- contributions/modules/article/article.module Base (1.23.2.5.2.1.2.13.2.3) +++ contributions/modules/article/article.module Locally Modified (Based On 1.23.2.5.2.1.2.13.2.3) @@ -179,6 +179,12 @@ '#default_value' => variable_get('article_pathauto', false), '#description' => t('Use the pathauto module to create links to article categories.') ); + $form['article_replace_taxonomy_links'] = array( + '#type' => 'checkbox', + '#title' => t('Replace taxonomy links to point to article based path'), + '#default_value' => variable_get('article_replace_taxonomy_links', false), + '#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.') + ); return system_settings_form($form); } @@ -420,7 +426,8 @@ */ function article_build_breadcrumbs($tid) { $parents = taxonomy_get_parents_all($tid); - $breadcrumb[] = l(drupal_ucfirst(t('home')), '/'); + //Home doesn't need to be / (issue: http://drupal.org/node/234209) + $breadcrumb[] = l(drupal_ucfirst(t('home')), ''); $breadcrumb[] = l(drupal_ucfirst(t(variable_get('article_title', 'Article'))), 'article/'); $parents = array_reverse($parents); @@ -432,6 +439,29 @@ return $term; } +/** + * Implementation of hook_link(); + * Replace current taxonomy link with article path + */ +function article_link_alter(&$links, $node) { + //Only process if the option is enabled + if (!variable_get('article_replace_taxonomy_links', false)) { + return; + } + //Get current article terms + $terms = article_get_article_terms(); + foreach ($links as $module => $link) { + if (strstr($module, 'taxonomy_term')) { + //Check if taxonomy term is included in the article vocabularies + $tid = str_replace('taxonomy/term/', '', $link['href']); + if (in_array($tid, $terms)) { + //Change current link to the article path + $links[$module]['href'] = 'article/'. $tid; + } + } + } +} + /** @} End of the module_article group **/