Vocabularies required per content type

njivy - May 9, 2006 - 19:20
Project:Drupal
Version:5.x-dev
Component:taxonomy.module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Allow a vocabulary to be required for some content types, optional for others, and disallowed for the rest.

Example:
Assume a forum configured to include multiple content types: forum- and story-type nodes. A forum-type node must have at least one term from the "Forums" vocabulary. But why should a story-type node be restricted to the forums?

The configuration UI at 'admin/taxonomy/edit/vocabulary/(vid)' is a good start. It defines which content types are disallowed. But the 'required' checkbox is too simple. Perhaps it could be replaced with something like the following multi-select list:

Required:
-forum topic
-story
-page
(Every selected node type must have at least one term in this vocabulary.)

#1

naught101 - March 31, 2007 - 12:19
Version:x.y.z» 5.x-dev

I agree, this is something that makes HEAPS of sense. but a better way of doing it would be to have a "required" tick-box next to each type:
Types: *
o Event            o required
o Forum topic  o required
o Image          o required
o Page            o required
o Story            o required
--A list of node types you want to associate with this vocabulary.

I would be willing to take this on, with some help. ie. where do I start?

#2

charly - May 21, 2007 - 12:31

bump

#3

xjm - August 4, 2007 - 16:20

I'd also find this feature useful.

#4

ekrispin - August 9, 2007 - 08:18

I'm also in need for such a flexibility. I have general instruction nodes that shouldn't have tags while I want to force users to tag their blog entries for example.

#5

ekrispin - August 9, 2007 - 09:05

I meanwhile added the following tweak to taxonomy module that allows whomever has taxonomy administeration permission (me) to post nodes with no tags regardless of the value of the generic 'required' field in admin/taxonomy.

<?php
if (user_access('administer taxonomy')) $form['taxonomy']['tags'][$vocabulary->vid]['#required'] = FALSE;
?>

Added it after line 711, right after:

<?php
$form
['taxonomy']['tags'][$vocabulary->vid] = array('#type' => 'textfield',
         
'#title' => $vocabulary->name,
         
'#description' => $help,
         
'#required' => $vocabulary->required,
         
'#default_value' => $typed_string,
         
'#autocomplete_path' => 'taxonomy/autocomplete/'. $vocabulary->vid,
         
'#weight' => $vocabulary->weight,
         
'#maxlength' => 255,
        );
?>

 
 

Drupal is a registered trademark of Dries Buytaert.