Allow specification of vocabulary in BlockTerm configuration
emdalton - October 5, 2009 - 18:33
| Project: | Block Term |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I don't know if this will ever be looked at, given that the maintainer of record hasn't even incorporated the patch that makes this module compatible with D6, but it would be nice to be able to configure Blockterm to restrict its display menu to a specific vocabulary. My site has a number of vocabularies that content creators generally don't use directly or that aren't appropriate for blocks. I'd like to simplify the Blockterm region to only display the primary "web tags" vocabulary that I want to use to tie blocks to content.

#1
I modified the end of _blockterm_form_alter to simply set the VID to the one I wanted to use as follows:
<?php
/* instead of foreach, set this to wsbe web tags vocab - vid= 11 */
/* foreach (taxonomy_get_vocabularies() as $vid => $vocab) { */
$vid = 11;
$vocab_select = taxonomy_form($vid);
$vocab_select['#multiple'] = true;
$vocab_select['#options'] = is_string($vocab_select['#options']['']) ? $vocab_select['#options'] : array(0 => theme('none_option')) + $vocab_select['#options'];
if ($blockterm[$var_name][$vid]) {
$default_value = $blockterm[$var_name][$vid];
}
$vocab_select['#default_value'] = $default_value;
$form['block_settings']['blockterm'][$vid] = $vocab_select;
$form['#submit'][] = 'blockterm_save';
/*} */
?>
I'd rather have this set as a parameter on the Taxonomy page somewhere, e.g. by checking off "blocks" as a type of content the vocabulary should apply to, but since blocks aren't always nodes, this is non-trivial, I guess. If anyone has any better suggestions, I'd love to hear them. As it stands, this isn't worth rolling a patch for, as it's too specific to our site.