function varbase_after_install_finished in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.8
Same name and namespace in other branches
- 8.4 varbase.profile \varbase_after_install_finished()
- 8.5 varbase.profile \varbase_after_install_finished()
- 8.6 varbase.profile \varbase_after_install_finished()
- 8.7 varbase.profile \varbase_after_install_finished()
- 9.0.x varbase.profile \varbase_after_install_finished()
Varbase after install finished.
Lanuch auto Varbase Tour auto launch after install.
Parameters
array $install_state: The current install state.
Return value
array A renderable array with a redirect header.
1 string reference to 'varbase_after_install_finished'
- varbase_install_tasks_alter in ./
varbase.profile - Implements hook_install_tasks_alter().
File
- ./
varbase.profile, line 486 - Enables modules and site configuration for a Varbase site installation.
Code
function varbase_after_install_finished(array &$install_state) {
// Mark all updates by the update helper checklist as successful on install.
if (\Drupal::moduleHandler()
->moduleExists('update_helper_checklist')) {
$checkList = \Drupal::service('update_helper_checklist.update_checklist');
$checkList
->markAllUpdates();
}
// Activate Varbase Bootstrap Paragraphs Settings in the active config.
if (\Drupal::moduleHandler()
->moduleExists('varbase_bootstrap_paragraphs')) {
$profile_path = drupal_get_path('profile', 'varbase') . '/config/optional/';
$config_path = $profile_path . 'varbase_bootstrap_paragraphs.settings.yml';
$config_content = file_get_contents($config_path);
$config_data = (array) Yaml::parse($config_content);
$config_factory = \Drupal::configFactory()
->getEditable('varbase_bootstrap_paragraphs.settings');
$config_factory
->setData($config_data)
->save(TRUE);
}
// Entity updates to clear up any mismatched entity and/or field definitions
// And Fix changes were detected in the entity type and field definitions.
\Drupal::classResolver()
->getInstanceFromDefinition(VarbaseEntityDefinitionUpdateManager::class)
->applyUpdates();
// Full flash and clear cash and rebuilding newly created routes.
// After install of extra modules by install: in the .info.yml files.
// In Varbase profile and all Varbase components.
// ---------------------------------------------------------------------------
// * Necessary inlitilization for the entire system.
// * Account for changed config by the end install.
// * Flush all persistent caches.
// * Flush asset file caches.
// * Wipe the Twig PHP Storage cache.
// * Rebuild module and theme data.
// * Clear all plugin caches.
// * Rebuild the menu router based on all rebuilt data.
drupal_flush_all_caches();
// Set front page to "/node".
// Issue #3188641: Change the set front page to "/node" process from
// using static node id to front page path by the alias.
// https://www.drupal.org/project/varbase_core/issues/3188641
try {
$path_alias_query = \Drupal::entityQuery('path_alias');
$path_alias_query
->condition('alias', '/node', '=');
$alias_ids = $path_alias_query
->execute();
if (count($alias_ids) > 0) {
foreach ($alias_ids as $alias_id) {
if (!end($alias_ids)) {
$path_alias = PathAlias::load($alias_id);
$path_alias
->delete();
}
else {
$page_front_path = PathAlias::load($alias_id)
->getPath();
\Drupal::configFactory()
->getEditable('system.site')
->set('page.front', $page_front_path)
->save();
}
}
}
} catch (\Exception $e) {
\Drupal::messenger()
->addError($e
->getMessage());
}
global $base_url;
// After install direction.
$after_install_direction = $base_url . '/?welcome';
install_finished($install_state);
$output = [];
// Clear all messages.
drupal_get_messages();
$output = [
'#title' => t('Varbase'),
'info' => [
'#markup' => t('<p>Congratulations, you have installed Varbase!</p><p>If you are not redirected to the front page in 5 seconds, Please <a href="@url">click here</a> to proceed to your installed site.</p>', [
'@url' => $after_install_direction,
]),
],
'#attached' => [
'http_header' => [
[
'Cache-Control',
'no-cache',
],
],
],
];
$meta_redirect = [
'#tag' => 'meta',
'#attributes' => [
'http-equiv' => 'refresh',
'content' => '0;url=' . $after_install_direction,
],
];
$output['#attached']['html_head'][] = [
$meta_redirect,
'meta_redirect',
];
return $output;
}