diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-19 13:31:14 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-19 13:31:14 +0000 |
commit | e998857eb8a5ef4d2ebe381a57c19b1b355fe4ef (patch) | |
tree | 88517c7981c03300ea0dc575f72719c8d3468027 /modules/taxonomy/taxonomy.module | |
parent | 24289301aba2666edb5909edf63cdb6cdedf994e (diff) | |
download | brdo-e998857eb8a5ef4d2ebe381a57c19b1b355fe4ef.tar.gz brdo-e998857eb8a5ef4d2ebe381a57c19b1b355fe4ef.tar.bz2 |
#516138 by yched, KarenS, quicksketch, bangpound, et al.: CC-FREAKING-K IN CORE! OH YEAH! :D
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 51 |
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; +} |