function social_final_site_setup in Open Social 8
Same name and namespace in other branches
- 8.2 social.profile \social_final_site_setup()
- 8.3 social.profile \social_final_site_setup()
- 8.4 social.profile \social_final_site_setup()
- 8.5 social.profile \social_final_site_setup()
- 8.6 social.profile \social_final_site_setup()
- 8.7 social.profile \social_final_site_setup()
Final setup of Social profile.
Parameters
array $install_state: The install state.
Return value
array Batch settings.
File
- ./
social.profile, line 261 - Enables modules and site configuration for a social site installation.
Code
function social_final_site_setup(array &$install_state) {
// Clear all status messages generated by modules installed in previous step.
drupal_get_messages('status', TRUE);
// There is no content at this point.
node_access_needs_rebuild(FALSE);
$batch = [];
$social_optional_modules = \Drupal::state()
->get('social_install_optional_modules');
foreach ($social_optional_modules as $module => $module_name) {
$batch['operations'][] = [
'_social_install_module_batch',
[
[
$module,
],
$module_name,
],
];
}
$demo_content = \Drupal::state()
->get('social_install_demo_content');
if ($demo_content === 1) {
$batch['operations'][] = [
'_social_install_module_batch',
[
[
'social_demo',
],
'social_demo',
],
];
// Generate demo content.
$demo_content_types = [
'file' => t('files'),
'user' => t('users'),
'group' => t('groups'),
'topic' => t('topics'),
'event' => t('events'),
'event_enrollment' => t('event enrollments'),
'post' => t('posts'),
'comment' => t('comments'),
'like' => t('likes'),
];
foreach ($demo_content_types as $demo_type => $demo_description) {
$batch['operations'][] = [
'_social_add_demo_batch',
[
$demo_type,
$demo_description,
],
];
}
// Uninstall social_demo.
$batch['operations'][] = [
'_social_uninstall_module_batch',
[
[
'social_demo',
],
'social_demo',
],
];
}
// Add some finalising steps.
$final_batched = [
'profile_weight' => t('Set weight of profile.'),
'router_rebuild' => t('Rebuild router.'),
'trigger_sapi_index' => t('Index search'),
'cron_run' => t('Run cron.'),
'import_optional_config' => t('Import optional configuration'),
];
foreach ($final_batched as $process => $description) {
$batch['operations'][] = [
'_social_finalise_batch',
[
$process,
$description,
],
];
}
return $batch;
}