function forum_install in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/forum/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();
}
}