By rogerpfaff on
Hello community,
i ported the core functionality of 'taxonomy hide' to 4.7.5 (don't know if it's backward compatible, but it should). What is missing so far is the grouping function.
function taxonomy_hide_help($section) {
$output = '';
switch ($section) {
case 'admin/modules#description':
$output = t('An interface for manipulating with vocabulary term list in node view.');
break;
}
return $output;
}
function taxonomy_hide_settings() {
if (!module_exist('taxonomy')) {
$output = l(t('Taxonomy module not enabled'), 'admin/modules');
}
else {
$options = array();
$options[0] = t('None');
foreach (taxonomy_get_vocabularies() as $vid => $vocs) {
$options[$vid] = $vocs->name;
}
$form['taxonomy_hide'] = array(
'#type' => 'select',
'#multiple' => true,
'#title' => t('Select the vocabularies which are hidden from display in nodes'),
'#default_value' => variable_get('taxonomy_hide', array()),
'#options' => $options,
'#description' => t('Select the Vocabularies which terms should not show up in nodes.'),
);
}
return $form;
}
function taxonomy_hide_nodeapi(&$node, $op, $arg = 0, $arg2 = 0) {
if (!module_exist('taxonomy')) {
return;
}
switch ($op) {
case 'view':
$hidden = variable_get('taxonomy_hide', array());
if (count($hidden) == 0) {
return;
}
foreach ($node->taxonomy as $tid => $tobj) {
if (in_array($tobj->vid, $hidden)) {
unset ($node->taxonomy[$tid]);
}
}
break;
}
return;
}
greetings
roger