| 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. |
| 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 |
|
|
| 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 |
|
|