summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r--modules/taxonomy/taxonomy.module51
1 files changed, 51 insertions, 0 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index c68056337..6294cf131 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -65,6 +65,25 @@ function taxonomy_field_build_modes($obj_type) {
}
/**
+ * Implement hook_field_extra_fields().
+ */
+function taxonomy_field_extra_fields($bundle) {
+ $extra = array();
+
+ if ($type = node_type_get_type($bundle)) {
+ if (taxonomy_get_vocabularies($bundle)) {
+ $extra['taxonomy'] = array(
+ 'label' => t('Taxonomy'),
+ 'description' => t('Taxonomy module element.'),
+ 'weight' => -3,
+ );
+ }
+ }
+
+ return $extra;
+}
+
+/**
* Implement hook_theme().
*/
function taxonomy_theme() {
@@ -2247,3 +2266,35 @@ function taxonomy_elements() {
),
);
}
+
+/**
+ * Implement hook_field_settings_form().
+ */
+function taxonomy_field_settings_form($field, $instance) {
+ // Get proper values for 'allowed_values_function', which is a core setting.
+ $vocabularies = taxonomy_get_vocabularies();
+ $options = array();
+ foreach ($vocabularies as $vocabulary) {
+ $options[$vocabulary->vid] = $vocabulary->name;
+ }
+ $form['allowed_values'] = array(
+ '#tree' => TRUE,
+ );
+
+ foreach ($field['settings']['allowed_values'] as $delta => $tree) {
+ $form['allowed_values'][$delta]['vid'] = array(
+ '#type' => 'select',
+ '#title' => t('Vocabulary'),
+ '#default_value' => $tree['vid'],
+ '#options' => $options,
+ '#required' => TRUE,
+ '#description' => t('The vocabulary which supplies the options for this field.'),
+ );
+ $form['allowed_values'][$delta]['parent'] = array(
+ '#type' => 'value',
+ '#value' => $tree['parent'],
+ );
+ }
+
+ return $form;
+}