Closed (fixed)
Project:
Node and Comments Form Settings
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
27 Apr 2010 at 10:25 UTC
Updated:
15 Mar 2011 at 20:21 UTC
I think this could be adapted and integrated with Node and Comments Form Settings
/**
* Implementation of hook_form_alter()
*
* Some code taken from http://drupal.org/node/225955
*/
function hide_taxonomy_fieldset_form_alter(&$form, $form_state, $form_id) {
//$form['form_array'] = array('#value' => '<pre>'. print_r($form, 1) . '</pre>');
if ($form_id == 'node_type_form') {
// Hide taxonomy fieldset
$form['hide_taxonomy_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t("Hide taxonomy fieldset"),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['hide_taxonomy_fieldset']['hide_taxonomy_fieldset_taxonomy'] = array(
'#title' => t("Display Vocabularies fieldset"),
'#type' => 'radios',
'#options' => array('0' => t("Enabled"), '1' => t("Disabled")),
'#default_value' => variable_get('hide_taxonomy_fieldset_taxonomy_'. $form['#node_type']->type, 0),
);
}
if(isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {
$node = $form['#node'];
// Hide taxonomy fieldset
if(variable_get('hide_taxonomy_fieldset_taxonomy_'. $node->type, '') == 1) {
$form['taxonomy']['#title'] = '' ;
$form['taxonomy']['#collapsible'] = '0' ;
}
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| hide_taxonomy_fieldset.zip | 7.08 KB | idflorin |
Comments
Comment #1
lelizondo commentedNice. The patch needs some work but I like the idea.
I have a couple of questions though.
Is this hiding or removing the fieldset? Will taxonomy still work?
Comment #2
idflorin commentedTaxonomy will still work.
This only removes the name "Vocabularies" - I know that this is not a good approach :( , but I think I'll work on it.
Comment #3
lelizondo commentedI'm interested, but I think this is not the correct approach, I think this could be so much better and easier:
http://drupal.org/node/739148#comment-3031146
Comment #4
lelizondo commentedComment #5
lelizondo commentedThis was committed and pushed on 6.x-2.x with the approach suggested by @goron posted at http://drupal.org/node/739148#comment-4155846