function social_topic_install in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/social_features/social_topic/social_topic.install \social_topic_install()
- 8 modules/social_features/social_topic/social_topic.install \social_topic_install()
- 8.2 modules/social_features/social_topic/social_topic.install \social_topic_install()
- 8.3 modules/social_features/social_topic/social_topic.install \social_topic_install()
- 8.4 modules/social_features/social_topic/social_topic.install \social_topic_install()
- 8.6 modules/social_features/social_topic/social_topic.install \social_topic_install()
- 8.7 modules/social_features/social_topic/social_topic.install \social_topic_install()
- 8.8 modules/social_features/social_topic/social_topic.install \social_topic_install()
- 10.3.x modules/social_features/social_topic/social_topic.install \social_topic_install()
- 10.0.x modules/social_features/social_topic/social_topic.install \social_topic_install()
- 10.1.x modules/social_features/social_topic/social_topic.install \social_topic_install()
- 10.2.x modules/social_features/social_topic/social_topic.install \social_topic_install()
Implements hook_install().
Perform actions related to the installation of social_topic.
File
- modules/
social_features/ social_topic/ social_topic.install, line 17 - Install, update and uninstall functions for the social_topic module.
Code
function social_topic_install() {
// Set some default permissions.
_social_topic_set_permissions();
// Add some links.
_social_topic_create_menu_links();
// Create some default taxonomy terms.
$terms = [
t('Blog'),
t('Discussion'),
t('News'),
];
foreach ($terms as $term_name) {
$term = Term::create([
'vid' => 'topic_types',
'name' => $term_name,
]);
$term
->save();
}
// Set default topic type settings.
$config = \Drupal::configFactory()
->getEditable('social_topic.settings');
$config
->set('social_topic_type_select_changer', 8);
$config
->save();
}