forum_install

forum_install()

Implements hook_install().

File

core/modules/forum/forum.install, line 14
Install, update, and uninstall functions for the Forum module.

Code

function forum_install() {
  // Set the weight of the forum.module to 1 so it is loaded after the taxonomy.module.
  module_set_weight('forum', 1);
  // Do not allow to delete the forum's node type machine name.
  $locked = \Drupal::state()->get('node.type.locked');
  $locked['forum'] = 'forum';
  \Drupal::state()->set('node.type.locked', $locked);

  if (!\Drupal::service('config.installer')->isSyncing()) {
    // Create a default forum so forum posts can be created.
    $term = Term::create(array(
      'name' => t('General discussion'),
      'description' => '',
      'parent' => array(0),
      'vid' => 'forums',
      'forum_container' => 0,
    ));
    $term->save();
  }
}
doc_Drupal
2016-10-29 09:17:18
Comments
Leave a Comment

Please login to continue.