| 1 |
<?php |
<?php |
| 2 |
// $Id: taxonomy_context.admin.inc,v 1.1.2.1 2009/10/03 18:47:11 nancyw Exp $ |
// $Id: taxonomy_context.admin.inc,v 1.1.2.2 2009/10/12 19:48:58 nancyw Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 11 |
drupal_add_css(drupal_get_path('module', 'taxonomy_context') . '/taxonomy_context.css'); |
drupal_add_css(drupal_get_path('module', 'taxonomy_context') . '/taxonomy_context.css'); |
| 12 |
|
|
| 13 |
$form = array(); |
$form = array(); |
| 14 |
$endis = array(t('Disabled'), t('Enabled')); |
$endis = array(t('No'), t('Yes')); |
| 15 |
|
|
| 16 |
$form['general_settings'] = array( |
$form['general'] = array( |
| 17 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 18 |
'#title' => t('General Settings'), |
'#title' => t('General Settings'), |
| 19 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 20 |
); |
); |
| 21 |
|
|
| 22 |
$form['general_settings']['taxonomy_context_use_style'] = array( |
$form['general']['taxonomy_context_use_style'] = array( |
| 23 |
'#type' => 'radios', |
'#type' => 'radios', |
| 24 |
'#title' => t('Use style for term and subterm display'), |
'#title' => t('Use style for term and subterm display'), |
| 25 |
'#default_value' => variable_get('taxonomy_context_use_style', 0), |
'#default_value' => variable_get('taxonomy_context_use_style', 0), |
| 26 |
'#options' => $endis, |
'#options' => $endis, |
| 27 |
'#description' => t('Include style declaration to clean up display of taxonomy info. Disable this option if you wish to do this instead through editing theme .css files.'), |
'#description' => t('Include the module\'s style declaration (CSS) to display taxonomy info. Disable this option if you wish to do this instead through editing your theme\'s .css files.'), |
| 28 |
); |
); |
| 29 |
|
|
| 30 |
$form['general_settings']['taxonomy_context_show_term'] = array( |
$form['general']['taxonomy_context_show_term'] = array( |
| 31 |
'#type' => 'radios', |
'#type' => 'radios', |
| 32 |
'#title' => t('Show term info'), |
'#title' => t('Show term info'), |
| 33 |
'#default_value' => variable_get('taxonomy_context_show_term', 1), |
'#default_value' => variable_get('taxonomy_context_show_term', 1), |
| 35 |
'#description' => t('Show additional information about current term (from description).'), |
'#description' => t('Show additional information about current term (from description).'), |
| 36 |
); |
); |
| 37 |
|
|
| 38 |
$form['general_settings']['taxonomy_context_show_subterms'] = array( |
$form['general']['taxonomy_context_show_subterms'] = array( |
| 39 |
'#type' => 'radios', |
'#type' => 'radios', |
| 40 |
'#title' => t('Show subterm info'), |
'#title' => t('Show subterm info'), |
| 41 |
'#default_value' => variable_get('taxonomy_context_show_subterms', 1), |
'#default_value' => variable_get('taxonomy_context_show_subterms', 1), |
| 43 |
'#description' => t('Show listings of subterms (sub-categories) for current term.'), |
'#description' => t('Show listings of subterms (sub-categories) for current term.'), |
| 44 |
); |
); |
| 45 |
|
|
| 46 |
$form['general_settings']['taxonomy_context_subterm_indent'] = array( |
$form['general']['taxonomy_context_subterm_indent'] = array( |
| 47 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 48 |
'#title' => t('Subterm indent character'), |
'#title' => t('Subterm indent character'), |
| 49 |
'#default_value' => variable_get('taxonomy_context_subterm_indent', '—'), |
'#default_value' => variable_get('taxonomy_context_subterm_indent', '—'), |
| 51 |
'#description' => t('Subterms will be indented to show hierarchy; this is what is used to show the indentation. It will be repeated for each level of depth.'), |
'#description' => t('Subterms will be indented to show hierarchy; this is what is used to show the indentation. It will be repeated for each level of depth.'), |
| 52 |
); |
); |
| 53 |
|
|
| 54 |
$form['general_settings']['taxonomy_context_max_depth'] = array( |
$form['general']['taxonomy_context_suppress_current'] = array( |
| 55 |
|
'#type' => 'radios', |
| 56 |
|
'#title' => t('Suppress current term on taxonomy/term/xxx page'), |
| 57 |
|
'#default_value' => variable_get('taxonomy_context_suppress_current', 0), |
| 58 |
|
'#options' => $endis, |
| 59 |
|
'#description' => t('Use this option to remove the current term from nodes shown on a taxonomy/term/xxx page. "No" is standard Drupal behavior; "yes" will remove the current term from each node selected.'), |
| 60 |
|
); |
| 61 |
|
|
| 62 |
|
$form['overview'] = array( |
| 63 |
|
'#type' => 'fieldset', |
| 64 |
|
'#title' => t('Overview pages'), |
| 65 |
|
'#collapsible' => TRUE, |
| 66 |
|
); |
| 67 |
|
|
| 68 |
|
$form['overview']['taxonomy_context_max_depth'] = array( |
| 69 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 70 |
'#title' => t('Maximum term depth for overview'), |
'#title' => t('Maximum term depth for overview'), |
| 71 |
'#default_value' => variable_get('taxonomy_context_max_depth', 1), |
'#default_value' => variable_get('taxonomy_context_max_depth', 1), |
| 72 |
'#size' => 8, |
'#size' => 8, |
| 73 |
'#description' => t('This is how deep in the hierarchy to show terms on the overview ("menu") page. A value of 1 show only the highest level.'), |
'#description' => t('This is how deep in the hierarchy to show terms on the overview ("menu") page. A value of 1 shows only the highest level.'), |
| 74 |
|
); |
| 75 |
|
|
| 76 |
|
$form['overview']['taxonomy_context_count_nodes'] = array( |
| 77 |
|
'#type' => 'radios', |
| 78 |
|
'#title' => t('Show node count on overview page'), |
| 79 |
|
'#default_value' => variable_get('taxonomy_context_count_nodes', 0), |
| 80 |
|
'#options' => $endis, |
| 81 |
|
'#description' => t('Show the number of nodes tagged with each term. For example: term-name (nnn)'), |
| 82 |
|
); |
| 83 |
|
|
| 84 |
|
$form['overview']['taxonomy_context_show_related'] = array( |
| 85 |
|
'#type' => 'radios', |
| 86 |
|
'#title' => t('Show related terms'), |
| 87 |
|
'#default_value' => variable_get('taxonomy_context_show_related', 0), |
| 88 |
|
'#options' => $endis, |
| 89 |
|
'#description' => t('If a term has related terms, show them as a cross-reference.'), |
| 90 |
); |
); |
| 91 |
|
|
| 92 |
|
$form['overview']['taxonomy_context_show_synonyms'] = array( |
| 93 |
|
'#type' => 'radios', |
| 94 |
|
'#title' => t('Show synonyms'), |
| 95 |
|
'#default_value' => variable_get('taxonomy_context_show_synonyms', 0), |
| 96 |
|
'#options' => $endis, |
| 97 |
|
'#description' => t('If a term has similar terms (synonyms), show them as a cross-reference.'), |
| 98 |
|
); |
| 99 |
|
|
| 100 |
$num_titles = variable_get('taxonomy_context_show_titles', 0); |
$num_titles = variable_get('taxonomy_context_show_titles', 0); |
| 101 |
$order = variable_get('taxonomy_context_show_order', 'n.title'); |
$order = variable_get('taxonomy_context_show_order', 'n.title'); |
| 102 |
|
|
| 103 |
$form['general_settings']['titles'] = array( |
$form['titles'] = array( |
| 104 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 105 |
'#title' => t('Node title display'), |
'#title' => t('Node title display'), |
| 106 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 107 |
); |
); |
| 108 |
|
|
| 109 |
$form['general_settings']['titles']['taxonomy_context_show_titles'] = array( |
$form['titles']['taxonomy_context_show_titles'] = array( |
| 110 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 111 |
'#title' => t('Maximum titles to show for each term'), |
'#title' => t('Maximum titles to show for each term'), |
| 112 |
'#default_value' => variable_get('taxonomy_context_show_titles', 0), |
'#default_value' => variable_get('taxonomy_context_show_titles', 0), |
| 114 |
'#description' => t('This is how many node titles to show for each term on the overview ("menu") page. A value of 0 means don\'t show any.'), |
'#description' => t('This is how many node titles to show for each term on the overview ("menu") page. A value of 0 means don\'t show any.'), |
| 115 |
); |
); |
| 116 |
|
|
| 117 |
$form['general_settings']['titles']['taxonomy_context_show_order'] = array( |
$form['titles']['taxonomy_context_show_order'] = array( |
| 118 |
'#type' => 'radios', |
'#type' => 'radios', |
| 119 |
'#title' => t('Title order'), |
'#title' => t('Title order'), |
| 120 |
'#default_value' => variable_get('taxonomy_context_show_order', 'n.title'), |
'#default_value' => variable_get('taxonomy_context_show_order', 'n.title'), |
| 125 |
'#description' => t('In what order do you wish to show the titles? This may also affect which titles are shown if there are more than the limit above.'), |
'#description' => t('In what order do you wish to show the titles? This may also affect which titles are shown if there are more than the limit above.'), |
| 126 |
); |
); |
| 127 |
|
|
| 128 |
$form['general_settings']['taxonomy_context_node_block'] = array( |
$form['blocks'] = array( |
| 129 |
'#type' => 'radios', |
'#type' => 'fieldset', |
| 130 |
'#title' => t('Show nodes in block'), |
'#title' => t('Block settings'), |
| 131 |
'#default_value' => variable_get('taxonomy_context_node_block', TAXONOMY_CONTEXT_NODE_BLOCK_NONE), |
'#collapsible' => TRUE, |
|
'#options' => array(t('None'), t('Sticky'), t('Promoted'), t('All')), |
|
|
'#description' => t('What nodes do you wish to display in taxonomy blocks?'), |
|
| 132 |
); |
); |
| 133 |
|
|
| 134 |
$form['general_settings']['taxonomy_context_block_display'] = array( |
$form['blocks']['taxonomy_context_block_display'] = array( |
| 135 |
'#type' => 'radios', |
'#type' => 'radios', |
| 136 |
'#title' => t('Show block items'), |
'#title' => t('Show block items'), |
| 137 |
'#default_value' => variable_get('taxonomy_context_block_display', TAXONOMY_CONTEXT_BLOCK_DISPLAY_COLLAPSED), |
'#default_value' => variable_get('taxonomy_context_block_display', TAXONOMY_CONTEXT_BLOCK_DISPLAY_COLLAPSED), |
| 139 |
'#description' => t('Do you want items on the menu expanded or collapsed by default?'), |
'#description' => t('Do you want items on the menu expanded or collapsed by default?'), |
| 140 |
); |
); |
| 141 |
|
|
| 142 |
$form['general_settings']['taxonomy_context_count_nodes'] = array( |
$form['blocks']['taxonomy_context_node_block'] = array( |
| 143 |
'#type' => 'radios', |
'#type' => 'radios', |
| 144 |
'#title' => t('Show node count on overview page'), |
'#title' => t('Show nodes in block'), |
| 145 |
'#default_value' => variable_get('taxonomy_context_count_nodes', 0), |
'#default_value' => variable_get('taxonomy_context_node_block', TAXONOMY_CONTEXT_NODE_BLOCK_NONE), |
| 146 |
'#options' => $endis, |
'#options' => array(t('None'), t('Sticky'), t('Promoted'), t('All')), |
| 147 |
'#description' => t('Show the number of nodes tagged with each term. For example: term-name (nnn)'), |
'#description' => t('What nodes do you wish to display in taxonomy blocks?'), |
| 148 |
); |
); |
| 149 |
|
|
| 150 |
$form['general_settings']['taxonomy_context_block_count_nodes'] = array( |
$form['blocks']['taxonomy_context_block_count_nodes'] = array( |
| 151 |
'#type' => 'radios', |
'#type' => 'radios', |
| 152 |
'#title' => t('Show count nodes in block items'), |
'#title' => t('Show node counts in block items'), |
| 153 |
'#default_value' => variable_get('taxonomy_context_block_count_nodes', TAXONOMY_CONTEXT_BLOCK_COUNT_NODES_FALSE), |
'#default_value' => variable_get('taxonomy_context_block_count_nodes', TAXONOMY_CONTEXT_BLOCK_COUNT_NODES_FALSE), |
| 154 |
'#options' => $endis, |
'#options' => $endis, |
| 155 |
'#description' => t('Show count nodes in block after items. Example: term (nnn)'), |
'#description' => t('Show node counts in block after items. Example: term (nnn)'), |
|
); |
|
|
|
|
|
$form['general_settings']['taxonomy_context_suppress_current'] = array( |
|
|
'#type' => 'radios', |
|
|
'#title' => t('Suppress current term on taxonomy/term/xxx page'), |
|
|
'#default_value' => variable_get('taxonomy_context_suppress_current', 0), |
|
|
'#options' => $endis, |
|
|
'#description' => t('Use this option to remove the current term from nodes shown on a taxonomy/term/xxx page. "Disabled" is standard Drupal behavior; "enabled" will remove the current term from each node selected.'), |
|
| 156 |
); |
); |
| 157 |
|
|
| 158 |
return system_settings_form($form); |
return system_settings_form($form); |