From f99d532111f465c54fa99ac045b3387399f4a2f6 Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Mon, 25 Jul 2005 04:55:37 +0000 Subject: [PATCH] - #16440: Allow taxonomy vocabulary and term forms to be extended. --- modules/taxonomy.module | 8 ++++++++ modules/taxonomy/taxonomy.module | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/modules/taxonomy.module b/modules/taxonomy.module index e4dab29891d..733f5cfb963 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -113,6 +113,8 @@ function taxonomy_form_vocabulary($edit = array()) { } $form .= form_textfield(t('Vocabulary name'), 'name', $edit['name'], 60, 64, t('The name for this vocabulary. Example: "Topic".'), NULL, TRUE); + // Prepend extra vocabulary form elements. + $form .= implode('', module_invoke_all('taxonomy', 'form pre', 'vocabulary', $edit)); $form .= form_textarea(t('Description'), 'description', $edit['description'], 60, 5, t('Description of the vocabulary; can be used by modules.')); $form .= form_textfield(t('Help text'), 'help', $edit['help'], 60, 255, t('Instructions to present to the user when choosing a term.')); $form .= form_checkboxes(t('Types'), 'nodes', $edit['nodes'], $nodes, t('A list of node types you want to associate with this vocabulary.'), NULL, TRUE); @@ -122,6 +124,8 @@ function taxonomy_form_vocabulary($edit = array()) { $form .= form_checkbox(t('Multiple select'), 'multiple', 1, $edit['multiple'], t('Allows nodes to have more than one term from this vocabulary (always true for free tagging).')); $form .= form_checkbox(t('Required'), 'required', 1, $edit['required'], t('If enabled, every node must have at least one term in this vocabulary.')); $form .= form_weight(t('Weight'), 'weight', $edit['weight'], 10, t('In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.')); + // Append extra vocabulary form elements. + $form .= implode('', module_invoke_all('taxonomy', 'form post', 'vocabulary', $edit)); $form .= form_submit(t('Submit')); if ($edit['vid']) { @@ -203,6 +207,8 @@ function taxonomy_form_term($edit = array()) { $vocabulary = taxonomy_get_vocabulary($vocabulary_id); $form = form_textfield(t('Term name'), 'name', $edit['name'], 60, 64, t('The name for this term. Example: "Linux".'), NULL, TRUE); + // Prepend extra term form elements. + $form .= implode('', module_invoke_all('taxonomy', 'form pre', 'term', $edit)); $form .= form_textarea(t('Description'), 'description', $edit['description'], 60, 5, t('A description of the term.')); if ($vocabulary->hierarchy) { @@ -229,6 +235,8 @@ function taxonomy_form_term($edit = array()) { $form .= form_textarea(t('Synonyms'), 'synonyms', implode("\n", taxonomy_get_synonyms($edit['tid'])), 60, 5, t('Synonyms of this term, one synonym per line.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'synonyms')))); $form .= form_weight(t('Weight'), 'weight', $edit['weight'], 10, t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.')); + // Append extra term form elements. + $form .= implode('', module_invoke_all('taxonomy', 'form post', 'term', $edit)); $form .= form_hidden('vid', $vocabulary->vid); $form .= form_submit(t('Submit')); diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index e4dab29891d..733f5cfb963 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -113,6 +113,8 @@ function taxonomy_form_vocabulary($edit = array()) { } $form .= form_textfield(t('Vocabulary name'), 'name', $edit['name'], 60, 64, t('The name for this vocabulary. Example: "Topic".'), NULL, TRUE); + // Prepend extra vocabulary form elements. + $form .= implode('', module_invoke_all('taxonomy', 'form pre', 'vocabulary', $edit)); $form .= form_textarea(t('Description'), 'description', $edit['description'], 60, 5, t('Description of the vocabulary; can be used by modules.')); $form .= form_textfield(t('Help text'), 'help', $edit['help'], 60, 255, t('Instructions to present to the user when choosing a term.')); $form .= form_checkboxes(t('Types'), 'nodes', $edit['nodes'], $nodes, t('A list of node types you want to associate with this vocabulary.'), NULL, TRUE); @@ -122,6 +124,8 @@ function taxonomy_form_vocabulary($edit = array()) { $form .= form_checkbox(t('Multiple select'), 'multiple', 1, $edit['multiple'], t('Allows nodes to have more than one term from this vocabulary (always true for free tagging).')); $form .= form_checkbox(t('Required'), 'required', 1, $edit['required'], t('If enabled, every node must have at least one term in this vocabulary.')); $form .= form_weight(t('Weight'), 'weight', $edit['weight'], 10, t('In listings, the heavier vocabularies will sink and the lighter vocabularies will be positioned nearer the top.')); + // Append extra vocabulary form elements. + $form .= implode('', module_invoke_all('taxonomy', 'form post', 'vocabulary', $edit)); $form .= form_submit(t('Submit')); if ($edit['vid']) { @@ -203,6 +207,8 @@ function taxonomy_form_term($edit = array()) { $vocabulary = taxonomy_get_vocabulary($vocabulary_id); $form = form_textfield(t('Term name'), 'name', $edit['name'], 60, 64, t('The name for this term. Example: "Linux".'), NULL, TRUE); + // Prepend extra term form elements. + $form .= implode('', module_invoke_all('taxonomy', 'form pre', 'term', $edit)); $form .= form_textarea(t('Description'), 'description', $edit['description'], 60, 5, t('A description of the term.')); if ($vocabulary->hierarchy) { @@ -229,6 +235,8 @@ function taxonomy_form_term($edit = array()) { $form .= form_textarea(t('Synonyms'), 'synonyms', implode("\n", taxonomy_get_synonyms($edit['tid'])), 60, 5, t('Synonyms of this term, one synonym per line.', array('%help-url' => url('admin/help/taxonomy', NULL, NULL, 'synonyms')))); $form .= form_weight(t('Weight'), 'weight', $edit['weight'], 10, t('In listings, the heavier terms will sink and the lighter terms will be positioned nearer the top.')); + // Append extra term form elements. + $form .= implode('', module_invoke_all('taxonomy', 'form post', 'term', $edit)); $form .= form_hidden('vid', $vocabulary->vid); $form .= form_submit(t('Submit'));