diff --git a/core/modules/forum/config/entity.display.taxonomy_term.forums.default.yml b/core/modules/forum/config/entity.display.taxonomy_term.forums.default.yml new file mode 100644 index 0000000..ef18047 --- /dev/null +++ b/core/modules/forum/config/entity.display.taxonomy_term.forums.default.yml @@ -0,0 +1,9 @@ +id: taxonomy_term.forums.default +uuid: adaef6a9-8dc0-4f2e-9858-88daac440aa9 +targetEntityType: taxonomy_term +bundle: forums +mode: default +content: + description: + weight: '0' + visible: '1' diff --git a/core/modules/forum/config/entity.form_display.taxonomy_term.forums.default.yml b/core/modules/forum/config/entity.form_display.taxonomy_term.forums.default.yml new file mode 100644 index 0000000..203b69a --- /dev/null +++ b/core/modules/forum/config/entity.form_display.taxonomy_term.forums.default.yml @@ -0,0 +1,12 @@ +id: taxonomy_term.forums.default +uuid: c8eab085-8fd3-4545-8600-e13b7d8bb9c4 +targetEntityType: taxonomy_term +bundle: forums +mode: default +content: + name: + weight: '-5' + visible: '1' + description: + weight: '0' + visible: '1' diff --git a/core/modules/forum/config/field.field.forum_container.yml b/core/modules/forum/config/field.field.forum_container.yml new file mode 100644 index 0000000..a8c34e9 --- /dev/null +++ b/core/modules/forum/config/field.field.forum_container.yml @@ -0,0 +1,22 @@ +id: forum_container +uuid: babf2ba1-505f-4c71-8a07-7be19f4fb9f3 +status: '1' +langcode: en +type: list_boolean +settings: + allowed_values: + - '' + - '' + allowed_values_function: '' +module: options +active: '1' +entity_types: { } +storage: + type: field_sql_storage + settings: { } + module: field_sql_storage + active: '1' +locked: '1' +cardinality: '1' +translatable: '0' +indexes: { } diff --git a/core/modules/forum/config/field.instance.taxonomy_term.forums.forum_container.yml b/core/modules/forum/config/field.instance.taxonomy_term.forums.forum_container.yml new file mode 100644 index 0000000..c8c36af --- /dev/null +++ b/core/modules/forum/config/field.instance.taxonomy_term.forums.forum_container.yml @@ -0,0 +1,16 @@ +id: taxonomy_term.forums.forum_container +uuid: 8421d585-f6ef-4209-ad00-cfb30a1ab075 +status: '1' +langcode: en +field_uuid: babf2ba1-505f-4c71-8a07-7be19f4fb9f3 +entity_type: taxonomy_term +bundle: forums +label: Container +description: '' +required: '1' +default_value: + - + value: '0' +default_value_function: '' +settings: { } +field_type: list_boolean diff --git a/core/modules/forum/config/forum.settings.yml b/core/modules/forum/config/forum.settings.yml index 3f0b30f..4f2516e 100644 --- a/core/modules/forum/config/forum.settings.yml +++ b/core/modules/forum/config/forum.settings.yml @@ -3,7 +3,6 @@ block: limit: '5' new: limit: '5' -containers: [] topics: hot_threshold: '15' order: '1' diff --git a/core/modules/forum/config/schema/forum.schema.yml b/core/modules/forum/config/schema/forum.schema.yml index 60bd0f7..9ca1ed8 100644 --- a/core/modules/forum/config/schema/forum.schema.yml +++ b/core/modules/forum/config/schema/forum.schema.yml @@ -22,12 +22,6 @@ forum.settings: limit: type: integer label: 'New forum Count' - containers: - type: sequence - label: 'Containers to group related forums' - sequence: - - type: integer - label: 'Taxonomy Term ID' topics: type: mapping label: 'Forum topics block' diff --git a/core/modules/forum/config/taxonomy.vocabulary.forums.yml b/core/modules/forum/config/taxonomy.vocabulary.forums.yml new file mode 100644 index 0000000..f033b38 --- /dev/null +++ b/core/modules/forum/config/taxonomy.vocabulary.forums.yml @@ -0,0 +1,8 @@ +vid: forums +uuid: a7f543a0-7bff-4eb6-b602-026a1bcb254b +name: Forums +description: 'Forum navigation vocabulary' +hierarchy: '1' +weight: '-10' +status: '1' +langcode: en diff --git a/core/modules/forum/forum.admin.inc b/core/modules/forum/forum.admin.inc index c45d281..82118fd 100644 --- a/core/modules/forum/forum.admin.inc +++ b/core/modules/forum/forum.admin.inc @@ -29,7 +29,7 @@ function forum_overview($form, &$form_state) { $term = $form['terms'][$key]['#term']; $form['terms'][$key]['term']['#href'] = 'forum/' . $term->id(); unset($form['terms'][$key]['operations']['#links']['delete']); - if ($term->container->value) { + if (!empty($term->forum_container->value)) { $form['terms'][$key]['operations']['#links']['edit']['title'] = t('edit container'); $form['terms'][$key]['operations']['#links']['edit']['href'] = 'admin/structure/forum/edit/container/' . $term->id(); // We don't want the redirect from the link so we can redirect the diff --git a/core/modules/forum/forum.info.yml b/core/modules/forum/forum.info.yml index 86e5627..c136ae4 100644 --- a/core/modules/forum/forum.info.yml +++ b/core/modules/forum/forum.info.yml @@ -6,6 +6,7 @@ dependencies: - history - taxonomy - comment + - options package: Core version: VERSION core: 8.x diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install index 60efc30..1f75055 100644 --- a/core/modules/forum/forum.install +++ b/core/modules/forum/forum.install @@ -5,6 +5,8 @@ * Install, update, and uninstall functions for the Forum module. */ +use Drupal\Core\Language\Language; + /** * Implements hook_install(). */ @@ -72,6 +74,7 @@ function forum_enable() { 'description' => '', 'parent' => array(0), 'vid' => $vocabulary->id(), + 'forum_container' => 0, )); $term->save(); @@ -118,6 +121,13 @@ function forum_uninstall() { $field->delete(); } + // Load the dependent Options module, in case it has been disabled. + drupal_load('module', 'options'); + + if ($field = field_info_field('forum_container')) { + $field->delete(); + } + // Purge field data now to allow taxonomy module to be uninstalled // if this is the only field remaining. field_purge_batch(10); @@ -260,13 +270,131 @@ function forum_update_last_removed() { * @ingroup config_upgrade */ function forum_update_8000() { + $map = db_query('SELECT vid, machine_name FROM {taxonomy_vocabulary}')->fetchAllKeyed(); + $forum_vid = update_variable_get('forum_nav_vocabulary', FALSE); + if (!empty($map[$forum_vid])) { + // Update the variable to reference the machine name instead of the vid. + update_variable_set('forum_nav_vocabulary', $map[$forum_vid]); + } update_variables_to_config('forum.settings', array( 'forum_hot_topic' => 'topics.hot_threshold', 'forum_per_page' => 'topics.page_limit', 'forum_order' => 'topics.order', 'forum_nav_vocabulary' => 'vocabulary', - 'forum_containers' => 'containers', 'forum_block_num_active' => 'block.active.limit', 'forum_block_num_new' => 'block.new.limit', )); } + +/** + * Implements hook_update_dependencies(). + */ +function forum_update_dependencies() { + // Convert containers to field after the fields and instances are converted to + // ConfigEntities. + $dependencies['forum'][8001] = array( + 'field' => 8003, + 'taxonomy' => 8007, + ); + return $dependencies; +} + +/** + * Adds the forum_container field and copies the values over. + */ +function forum_update_8001() { + $vocabulary = config('forum.settings')->get('vocabulary'); + // Create the field and instance. + $field = array( + 'id' => 'forum_container', + 'module' => 'options', + 'type' => 'list_boolean', + 'cardinality' => 1, + 'locked' => TRUE, + 'indexes' => array(), + 'settings' => array( + 'allowed_values' => array('', ''), + 'allowed_values_function' => '', + ), + 'schema' => array( + 'columns' => array( + 'value' => array( + 'type' => 'int', + 'not null' => FALSE, + ), + ), + 'indexes' => array(), + 'foreign keys' => array(), + ), + ); + _update_8003_field_create_field($field); + + $instance = array( + 'id' => 'taxonomy_term.' . $vocabulary . '.forum_container', + 'entity_type' => 'taxonomy_term', + 'label' => 'Container', + 'bundle' => $vocabulary, + 'description' => '', + 'required' => TRUE, + 'settings' => array(), + 'default_value' => array('value' => 0), + ); + _update_8003_field_create_instance($field, $instance); +} + +/** + * Migrate forum containers from variable to field values. + */ +function forum_update_8002(&$sandbox) { + // Initialize total values to process. + if (!isset($sandbox['total'])) { + $containers = update_variable_get('forum_containers', array()); + $vocabulary = config('forum.settings')->get('vocabulary'); + $sandbox['containers'] = $containers; + $sandbox['vocabulary'] = $vocabulary; + $sandbox['total'] = count($containers); + $sandbox['processed'] = 0; + } + + if ($sandbox['total']) { + // Retrieve next 20 containers to migrate. + $containers = array_splice($containers, $sandbox['processed'], 20); + foreach ($containers as $tid) { + // Add a row to the field data and revision tables. + db_insert('field_data_forum_container') + ->fields(array( + 'entity_type' => 'taxonomy_term', + 'bundle' => $sandbox['vocabulary'], + 'entity_id' => $tid, + 'revision_id' => $tid, + 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'delta' => 0, + 'forum_container_value' => 1, + )) + ->execute(); + db_insert('field_revision_forum_container') + ->fields(array( + 'entity_type' => 'taxonomy_term', + 'bundle' => $vocabulary, + 'entity_id' => $tid, + 'revision_id' => $tid, + 'langcode' => Language::LANGCODE_NOT_SPECIFIED, + 'delta' => 0, + 'forum_container_value' => 1, + )) + ->execute(); + } + + // Report status. + $sandbox['processed'] += count($containers); + } + $sandbox['#finished'] = $sandbox['total'] ? $sandbox['processed'] / $sandbox['total'] : 1; + +} + +/** + * Remove the forum_containers variable. + */ +function forum_update_8003() { + update_variable_del('forum_containers'); +} diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 024c595..5ca4632 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -75,7 +75,7 @@ function forum_theme() { return array( 'forums' => array( 'template' => 'forums', - 'variables' => array('forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'tid' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL), + 'variables' => array('forums' => NULL, 'topics' => NULL, 'parents' => NULL, 'term' => NULL, 'sortby' => NULL, 'forum_per_page' => NULL), ), 'forum_list' => array( 'template' => 'forum-list', @@ -281,7 +281,7 @@ function forum_node_validate(EntityInterface $node, $form) { ':tid' => $term->id(), ':vid' => $term->bundle(), ))->fetchField(); - if ($used && $term->container->value) { + if ($used && !empty($term->forum_container->value)) { form_set_error('taxonomy_forums', t('The item %forum is a forum container, not a forum. Select one of the forums below instead.', array('%forum' => $term->label()))); } } @@ -430,22 +430,6 @@ function forum_permission() { } /** - * Implements hook_taxonomy_term_delete(). - */ -function forum_taxonomy_term_delete(Term $term) { - if ($term->container->value) { - // For containers, remove the tid from the forum_containers variable. - $config = config('forum.settings'); - $containers = $config->get('containers'); - $key = array_search($term->id(), $containers); - if ($key !== FALSE) { - unset($containers[$key]); - $config->set('containers', $containers)->save(); - } - } -} - -/** * Implements hook_comment_publish(). * * This actually handles the insertion and update of published nodes since @@ -656,7 +640,7 @@ function forum_preprocess_block(&$variables) { * - topics: An array of all the topics in the current forum. * - parents: An array of taxonomy term objects that are ancestors of the * current term ID. - * - tid: Taxonomy term ID of the current forum. + * - term: Taxonomy term of the current forum. * - sortby: One of the following integers indicating the sort criteria: * - 1: Date - newest first. * - 2: Date - oldest first. @@ -665,6 +649,7 @@ function forum_preprocess_block(&$variables) { * - forum_per_page: The maximum number of topics to display per page. */ function template_preprocess_forums(&$variables) { + $variables['tid'] = $variables['term']->id(); if ($variables['forums_defined'] = count($variables['forums']) || count($variables['parents'])) { if (!empty($variables['forums'])) { $variables['forums'] = array( @@ -678,7 +663,7 @@ function template_preprocess_forums(&$variables) { $variables['forums'] = array(); } - if ($variables['tid'] && array_search($variables['tid'], Drupal::config('forum.settings')->get('containers')) === FALSE) { + if ($variables['term'] && empty($variables['term']->forum_container->value)) { $variables['topics'] = array( '#theme' => 'forum_topic_list', '#tid' => $variables['tid'], @@ -735,7 +720,7 @@ function template_preprocess_forum_list(&$variables) { $variables['forums'][$id]->description = filter_xss_admin($forum->description->value); $variables['forums'][$id]->link = url("forum/" . $forum->id()); $variables['forums'][$id]->name = check_plain($forum->label()); - $variables['forums'][$id]->is_container = !empty($forum->container->value); + $variables['forums'][$id]->is_container = !empty($forum->forum_container->value); $variables['forums'][$id]->zebra = $row % 2 == 0 ? 'odd' : 'even'; $row++; @@ -782,12 +767,14 @@ function template_preprocess_forum_list(&$variables) { function template_preprocess_forum_topic_list(&$variables) { global $forum_topic_list_header; - // Create the tablesorting header. - $ts = tablesort_init($forum_topic_list_header); $header = ''; - foreach ($forum_topic_list_header as $cell) { - $cell = tablesort_header($cell, $forum_topic_list_header, $ts); - $header .= _theme_table_cell($cell, TRUE); + if (!empty($forum_topic_list_header)) { + // Create the tablesorting header. + $ts = tablesort_init($forum_topic_list_header); + foreach ($forum_topic_list_header as $cell) { + $cell = tablesort_header($cell, $forum_topic_list_header, $ts); + $header .= _theme_table_cell($cell, TRUE); + } } $variables['header'] = $header; @@ -925,21 +912,3 @@ function template_preprocess_forum_submitted(&$variables) { function theme_forum_form(array $variables) { return drupal_render_children($variables['form']); } - -/** - * Implements hook_entity_field_info(). - */ -function forum_entity_field_info($entity_type) { - $info = array(); - if ($entity_type == 'taxonomy_term') { - $vid = Drupal::config('forum.settings')->get('vocabulary'); - $info['optional']['container'] = array( - 'type' => 'boolean_field', - 'label' => t('Forum container'), - 'computed' => TRUE, - 'class' => '\Drupal\forum\ForumContainerItem', - ); - $info['bundle map'][$vid][] = 'container'; - } - return $info; -} diff --git a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php index 0795aed..6d68a01 100644 --- a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php +++ b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php @@ -116,18 +116,18 @@ public function forumPage(TermInterface $taxonomy_term) { // Get forum details. $taxonomy_term->forums = $this->forumManager->getChildren($this->config->get('vocabulary'), $taxonomy_term->id()); $taxonomy_term->parents = $this->forumManager->getParents($taxonomy_term->id()); - if ($taxonomy_term->container->value) { + if (empty($taxonomy_term->forum_container->value)) { // Add RSS feed for forums. drupal_add_feed('taxonomy/term/' . $taxonomy_term->id() . '/feed', 'RSS - ' . $taxonomy_term->label()); } - if (!$taxonomy_term->container->value) { + if (empty($taxonomy_term->forum_container->value)) { $topics = $this->forumManager->getTopics($taxonomy_term->id()); } else { $topics = ''; } - return $this->build($taxonomy_term->forums, $taxonomy_term->id(), $topics, $taxonomy_term->parents); + return $this->build($taxonomy_term->forums, $taxonomy_term, $topics, $taxonomy_term->parents); } /** @@ -147,7 +147,7 @@ public function forumIndex() { // Set the page title to forum's vocabulary name. drupal_set_title($vocabulary->label()); } - return $this->build($index->forums, $index->id()); + return $this->build($index->forums, $index); } /** @@ -155,9 +155,9 @@ public function forumIndex() { * * @param array $forums * A list of forums. - * @param int $tid + * @param \Drupal\taxonomy\TermInterface $term * The taxonomy term of the forum. - * @param string $topics + * @param array $topics * The topics of this forum. * @param array $parents * The parent forums in relation this forum. @@ -165,18 +165,18 @@ public function forumIndex() { * @return array * A render array. */ - protected function build($forums, $tid, $topics = '', $parents = array()) { + protected function build($forums, TermInterface $term, $topics = array(), $parents = array()) { $build = array( '#theme' => 'forums', '#forums' => $forums, '#topics' => $topics, '#parents' => $parents, - '#tid' => $tid, + '#term' => $term, '#sortby' => $this->config->get('topics.order'), '#forums_per_page' => $this->config->get('topics.page_limit'), ); // @todo Make this a library - see https://drupal.org/node/2028113. - $build['#attached']['css'][] = drupal_get_path('module', 'forum') . '/forum.css'; + $build['#attached']['css'][] = drupal_get_path('module', 'forum') . '/css/forum.module.css'; return $build; } @@ -190,6 +190,7 @@ public function addForum() { $vid = $this->config->get('vocabulary'); $taxonomy_term = $this->termStorageController->create(array( 'vid' => $vid, + 'forum_controller' => 0, )); return $this->entityManager->getForm($taxonomy_term, 'forum'); } @@ -204,6 +205,7 @@ public function addContainer() { $vid = $this->config->get('vocabulary'); $taxonomy_term = $this->termStorageController->create(array( 'vid' => $vid, + 'forum_container' => 1, )); return $this->entityManager->getForm($taxonomy_term, 'container'); } diff --git a/core/modules/forum/lib/Drupal/forum/Form/ContainerFormController.php b/core/modules/forum/lib/Drupal/forum/Form/ContainerFormController.php index a40c83b..d630525 100644 --- a/core/modules/forum/lib/Drupal/forum/Form/ContainerFormController.php +++ b/core/modules/forum/lib/Drupal/forum/Form/ContainerFormController.php @@ -42,13 +42,8 @@ public function form(array $form, array &$form_state) { */ public function save(array $form, array &$form_state) { $is_new = $this->entity->isNew(); + $this->entity->forum_container = TRUE; $term = parent::save($form, $form_state); - if ($is_new) { - // Update config item to track the container terms. - $containers = $this->config->get('containers'); - $containers[] = $term->id(); - $this->config->set('containers', $containers)->save(); - } } } diff --git a/core/modules/forum/lib/Drupal/forum/ForumContainerItem.php b/core/modules/forum/lib/Drupal/forum/ForumContainerItem.php deleted file mode 100644 index ab185ee..0000000 --- a/core/modules/forum/lib/Drupal/forum/ForumContainerItem.php +++ /dev/null @@ -1,41 +0,0 @@ - 'boolean', - 'label' => t('Boolean value'), - 'class' => '\Drupal\forum\ForumContainerValue', - 'computed' => TRUE, - ); - } - return static::$propertyDefinitions; - } -} diff --git a/core/modules/forum/lib/Drupal/forum/ForumContainerValue.php b/core/modules/forum/lib/Drupal/forum/ForumContainerValue.php deleted file mode 100644 index 54f18d1..0000000 --- a/core/modules/forum/lib/Drupal/forum/ForumContainerValue.php +++ /dev/null @@ -1,56 +0,0 @@ -value)) { - if (!isset($this->parent)) { - throw new InvalidArgumentException('Computed properties require context for computation.'); - } - $entity = $this->parent->getParent()->getParent(); - $tid = $entity->tid->target_id; - // @todo Remove when TypedData objects can receive injected dependencies. - // See https://drupal.org/node/2053415. - $config = \Drupal::config('forum.settings'); - $this->value = ($entity->bundle() == $config->get('vocabulary') && in_array($entity->id(), $config->get('containers'))); - } - return $this->value; - } - - /** - * {@inheritdoc} - */ - public function setValue($value, $notify = TRUE) { - if (isset($value)) { - if (!isset($this->parent)) { - throw new InvalidArgumentException('Computed properties require context for computation.'); - } - $entity = $this->parent->getParent()->getParent(); - if (!$entity->isNew()) { - throw new ReadOnlyException('Unable to set a computed property.'); - } - else { - // The container value can be set for new entities. - parent::setValue($value, $notify); - } - } - } - -} diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index b07f938..18051e1 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -414,6 +414,8 @@ function createForum($type, $parent = 0) { $parent_tid = db_query("SELECT t.parent FROM {taxonomy_term_hierarchy} t WHERE t.tid = :tid", array(':tid' => $tid))->fetchField(); $this->assertTrue($parent == $parent_tid, 'The ' . $type . ' is linked to its container'); + $forum = $this->container->get('plugin.manager.entity')->getStorageController('taxonomy_term')->load($tid); + $this->assertEqual(($type == 'forum container'), (bool) $forum->forum_container->value); return $term; } @@ -434,11 +436,6 @@ function deleteForum($tid) { // Assert that the forum no longer exists. $this->drupalGet('forum/' . $tid); $this->assertResponse(404, 'The forum was not found'); - - // Assert that the associated term has been removed from the - // forum_containers variable. - $containers = \Drupal::config('forum.settings')->get('containers'); - $this->assertFalse(in_array($tid, $containers), 'The forum_containers variable has been updated.'); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/ForumUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ForumUpgradePathTest.php new file mode 100644 index 0000000..1c936d5 --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/ForumUpgradePathTest.php @@ -0,0 +1,58 @@ + 'Forum upgrade test', + 'description' => 'Upgrade tests with forum data.', + 'group' => 'Upgrade path', + ); + } + + public function setUp() { + $path = drupal_get_path('module', 'system') . '/tests/upgrade'; + $this->databaseDumpFiles = array( + $path . '/drupal-7.bare.standard_all.database.php.gz', + $path . '/drupal-7.forum.database.php', + ); + parent::setUp(); + } + + /** + * Tests expected forum and container conversions after a successful upgrade. + */ + public function testForumUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + + // Make sure the field is created. + $vocabulary = $this->container->get('config.factory')->get('forum.settings')->get('vocabulary'); + $field = field_info_instance('taxonomy_term', 'forum_container', $vocabulary); + $this->assertTrue((bool) $field, 'Field was found'); + + // Check that the values of forum_container are correct. + $containers = entity_load_multiple_by_properties('taxonomy_term', array('name' => 'Container')); + $container = reset($containers); + $this->assertTrue((bool) $container->forum_container->value); + + $forums = entity_load_multiple_by_properties('taxonomy_term', array('name' => 'Forum')); + $forum = reset($forums); + $this->assertFalse((bool) $forum->forum_container->value); + } + +} diff --git a/core/modules/system/tests/upgrade/drupal-7.forum.database.php b/core/modules/system/tests/upgrade/drupal-7.forum.database.php new file mode 100644 index 0000000..b6e6cf8 --- /dev/null +++ b/core/modules/system/tests/upgrade/drupal-7.forum.database.php @@ -0,0 +1,48 @@ +fields('tv', array('vid')) + ->condition('name', 'forums') + ->execute() + ->fetchField(); + +$container = db_insert('taxonomy_term_data') + ->fields(array( + 'vid' => $vocabulary, + 'name' => 'Container', + 'description' => 'Container', + 'format' => 'full_html', + 'weight' => 0, + )) + ->execute(); + +$forum = db_insert('taxonomy_term_data') + ->fields(array( + 'vid' => $vocabulary, + 'name' => 'Forum', + 'description' => 'Forum', + 'format' => 'full_html', + 'weight' => 0, + )) + ->execute(); + +db_delete('variable') + ->condition('name', 'forum_containers') + ->execute(); + +db_insert('variable')->fields(array( + 'name' => 'forum_containers', + 'value' => serialize(array($container)), +)) +->execute();