| 1 |
<?php
|
| 2 |
// $Id: taxonomy_theme.module,v 1.49 2008/06/08 15:21:03 profix898 Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_theme()
|
| 6 |
*/
|
| 7 |
function taxonomy_theme_theme() {
|
| 8 |
return array(
|
| 9 |
'taxonomy_theme_table' => array(
|
| 10 |
'arguments' => array('form' => NULL),
|
| 11 |
)
|
| 12 |
);
|
| 13 |
}
|
| 14 |
|
| 15 |
/**
|
| 16 |
* Implementation of hook_perm().
|
| 17 |
*/
|
| 18 |
function taxonomy_theme_perm() {
|
| 19 |
return array('administer taxonomy theme');
|
| 20 |
}
|
| 21 |
|
| 22 |
/**
|
| 23 |
* Implementation of hook_menu().
|
| 24 |
*/
|
| 25 |
function taxonomy_theme_menu() {
|
| 26 |
$items = array();
|
| 27 |
$items['admin/settings/themekey/taxonomy'] = array(
|
| 28 |
'title' => 'Taxonomy',
|
| 29 |
'access callback' => 'user_access',
|
| 30 |
'access arguments' => array('administer taxonomy theme'),
|
| 31 |
'file' => 'taxonomy_theme_admin.inc',
|
| 32 |
'page callback' => 'drupal_get_form',
|
| 33 |
'page arguments' => array('taxonomy_theme_admin_form'),
|
| 34 |
'type' => MENU_LOCAL_TASK,
|
| 35 |
'weight' => 3
|
| 36 |
);
|
| 37 |
$items['admin/settings/themekey/taxonomy/confirm'] = array(
|
| 38 |
'access callback' => 'user_access',
|
| 39 |
'access arguments' => array('administer taxonomy theme'),
|
| 40 |
'file' => 'taxonomy_theme_admin.inc',
|
| 41 |
'page callback' => 'drupal_get_form',
|
| 42 |
'page arguments' => array('_taxonomy_theme_admin_form_confirm'),
|
| 43 |
'type' => MENU_CALLBACK
|
| 44 |
);
|
| 45 |
|
| 46 |
return $items;
|
| 47 |
}
|
| 48 |
|
| 49 |
/**
|
| 50 |
* Implementation of hook_form_alter().
|
| 51 |
*/
|
| 52 |
function taxonomy_theme_form_alter(&$form, $form_state, $form_id) {
|
| 53 |
if (in_array($form_id, array('taxonomy_form_term', 'taxonomy_form_vocabulary')) && user_access('administer taxonomy_theme')) {
|
| 54 |
require_once(drupal_get_path('module', 'taxonomy_theme') .'/taxonomy_theme_admin.inc');
|
| 55 |
_taxonomy_theme_form_alter($form, $form_state, $form_id);
|
| 56 |
}
|
| 57 |
}
|
| 58 |
|
| 59 |
/**
|
| 60 |
* Function taxonomy_theme_form_alter_submit().
|
| 61 |
*/
|
| 62 |
function taxonomy_theme_form_alter_submit($form, &$form_state) {
|
| 63 |
require_once(drupal_get_path('module', 'taxonomy_theme') .'/taxonomy_theme_admin.inc');
|
| 64 |
_taxonomy_theme_form_alter_submit($form, $form_state);
|
| 65 |
}
|
| 66 |
|
| 67 |
/**
|
| 68 |
* Implementation of hook_taxonomy().
|
| 69 |
*/
|
| 70 |
function taxonomy_theme_taxonomy($op, $type, $array) {
|
| 71 |
require_once(drupal_get_path('module', 'themekey') .'/themekey_build.inc');
|
| 72 |
//
|
| 73 |
if ($type == 'vocabulary') {
|
| 74 |
if ($op == 'delete') {
|
| 75 |
db_query('DELETE FROM {themekey_properties} WHERE property = \'taxonomy:vid\' AND value = \'%s\'', $array['vid']);
|
| 76 |
}
|
| 77 |
_themekey_properties_resort('taxonomy:vid');
|
| 78 |
}
|
| 79 |
else if ($type == 'term') {
|
| 80 |
if ($op == 'delete') {
|
| 81 |
db_query('DELETE FROM {themekey_properties} WHERE property = \'taxonomy:tid\' AND value = \'%s\'', $array['tid']);
|
| 82 |
}
|
| 83 |
_themekey_properties_resort('taxonomy:tid');
|
| 84 |
}
|
| 85 |
}
|