You are here

function varbase_after_install_finished in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.5

Same name and namespace in other branches
  1. 8.8 varbase.profile \varbase_after_install_finished()
  2. 8.4 varbase.profile \varbase_after_install_finished()
  3. 8.6 varbase.profile \varbase_after_install_finished()
  4. 8.7 varbase.profile \varbase_after_install_finished()
  5. 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 436
Enables modules and site configuration for a Varbase site installation.

Code

function varbase_after_install_finished(array &$install_state) {

  // 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);
  }
  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;
}