| 1 |
|
<?php // -*-php-*- |
| 2 |
|
// $Id$ |
| 3 |
|
|
| 4 |
|
function article_pathauto($op) { |
| 5 |
|
switch ($op) { |
| 6 |
|
case 'settings': |
| 7 |
|
$settings = array(); |
| 8 |
|
$settings['module'] = 'article'; |
| 9 |
|
$settings['token_type'] = 'taxonomy'; |
| 10 |
|
$settings['groupheader'] = t('Article path settings'); |
| 11 |
|
$settings['patterndescr'] = t('Patterns for Article module'); |
| 12 |
|
$settings['patterndefault'] = t('article/[cat-raw]'); |
| 13 |
|
return (object) $settings; |
| 14 |
|
default: |
| 15 |
|
break; |
| 16 |
|
} |
| 17 |
|
} |
| 18 |
|
|
| 19 |
|
/** |
| 20 |
|
* Implementation of hook_taxonomy() |
| 21 |
|
*/ |
| 22 |
|
function article_taxonomy($op, $type, $array = NULL) { |
| 23 |
|
if ($type != 'term') { |
| 24 |
|
return; |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
$vocab = variable_get('article_vocab', ''); |
| 28 |
|
if (!is_array($vocab)) { |
| 29 |
|
return; |
| 30 |
|
} |
| 31 |
|
|
| 32 |
|
if (!in_array($array['vid'], array_values($vocab))) { |
| 33 |
|
return; |
| 34 |
|
} |
| 35 |
|
|
| 36 |
|
switch ($op) { |
| 37 |
|
case 'insert': |
| 38 |
|
case 'update': |
| 39 |
|
_pathauto_include(); |
| 40 |
|
$placeholders = pathauto_get_placeholders('taxonomy', (object)$array); |
| 41 |
|
$placeholders; |
| 42 |
|
pathauto_create_alias('article', $op, $placeholders, 'article/'.$array['tid']); |
| 43 |
|
default: |
| 44 |
|
break; |
| 45 |
|
} |
| 46 |
|
} |
| 47 |
|
?> |