diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-08-17 21:44:37 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-08-17 21:44:37 +0000 |
commit | 27df25f60f7f17f224a3f97800a2211f64e85e7c (patch) | |
tree | e37dc1839afea56375ea4005f138128d4f9d7f03 /modules/forum | |
parent | 2d3af8fe80715bb8b682f00272e731619d3102a8 (diff) | |
download | brdo-27df25f60f7f17f224a3f97800a2211f64e85e7c.tar.gz brdo-27df25f60f7f17f224a3f97800a2211f64e85e7c.tar.bz2 |
- Patch #821290 by marcingy, aspilicious, scor, catch, ronald_istos: unexpected error after disabling - unistalling - re-enabling forum module.
Diffstat (limited to 'modules/forum')
-rw-r--r-- | modules/forum/forum.install | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/modules/forum/forum.install b/modules/forum/forum.install index ea1771230..205430dd1 100644 --- a/modules/forum/forum.install +++ b/modules/forum/forum.install @@ -24,6 +24,10 @@ function forum_install() { * Implements hook_enable(). */ function forum_enable() { + // If we enable forum at the same time as taxonomy we need to call + // field_associate_fields() as otherwise the field won't be enabled until + // hook modules_enabled is called which takes place after hook_enable events. + field_associate_fields('taxonomy'); // Create the forum vocabulary if it does not exist. $vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', 0)); if (!$vocabulary) { @@ -56,28 +60,6 @@ function forum_enable() { ); field_create_field($field); - $instance = array( - 'field_name' => 'taxonomy_' . $vocabulary->machine_name, - 'entity_type' => 'node', - 'label' => $vocabulary->name, - 'bundle' => 'forum', - 'required' => TRUE, - 'widget' => array( - 'type' => 'options_select', - ), - 'display' => array( - 'default' => array( - 'type' => 'taxonomy_term_reference_link', - 'weight' => 10, - ), - 'teaser' => array( - 'type' => 'taxonomy_term_reference_link', - 'weight' => 10, - ), - ), - ); - field_create_instance($instance); - variable_set('forum_nav_vocabulary', $vocabulary->vid); // Create a default forum so forum posts can be created. @@ -90,6 +72,30 @@ function forum_enable() { $term = (object) $edit; taxonomy_term_save($term); } + + // Create the instance on the bundle. + $instance = array( + 'field_name' => 'taxonomy_' . $vocabulary->machine_name, + 'entity_type' => 'node', + 'label' => $vocabulary->name, + 'bundle' => 'forum', + 'required' => TRUE, + 'widget' => array( + 'type' => 'options_select', + ), + 'display' => array( + 'default' => array( + 'type' => 'taxonomy_term_reference_link', + 'weight' => 10, + ), + 'teaser' => array( + 'type' => 'taxonomy_term_reference_link', + 'weight' => 10, + ), + ), + ); + field_create_instance($instance); + // Ensure the forum node type is available. node_types_rebuild(); $types = node_type_get_types(); |