You are here

function social_install_tasks_alter in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 social.profile \social_install_tasks_alter()
  2. 8 social.profile \social_install_tasks_alter()
  3. 8.2 social.profile \social_install_tasks_alter()
  4. 8.3 social.profile \social_install_tasks_alter()
  5. 8.4 social.profile \social_install_tasks_alter()
  6. 8.5 social.profile \social_install_tasks_alter()
  7. 8.6 social.profile \social_install_tasks_alter()
  8. 8.7 social.profile \social_install_tasks_alter()
  9. 8.8 social.profile \social_install_tasks_alter()
  10. 10.3.x social.profile \social_install_tasks_alter()
  11. 10.0.x social.profile \social_install_tasks_alter()
  12. 10.2.x social.profile \social_install_tasks_alter()

Implements hook_install_tasks_alter().

Unfortunately we have to alter the verify requirements. This is because of https://www.drupal.org/node/1253774. The dependencies of dependencies are not tested. So adding requirements to our install profile hook_requirements will not work :(. Also take a look at install.inc function drupal_check_profile() it just checks for all the dependencies of our install profile from the info file. And no actually hook_requirements in there.

File

./social.profile, line 41
Enables modules and site configuration for a social site installation.

Code

function social_install_tasks_alter(&$tasks, $install_state) {

  // Override the core install_verify_requirements task function.
  $tasks['install_verify_requirements']['function'] = 'social_verify_custom_requirements';

  // Allow the user to select optional modules and have Drupal install those for
  // us. To make this work we have to position our optional form right before
  // install_profile_modules.
  $task_keys = array_keys($tasks);
  $insert_before = array_search('install_profile_modules', $task_keys, TRUE);
  $tasks = array_slice($tasks, 0, $insert_before - 1, TRUE) + [
    'social_module_configure_form' => [
      'display_name' => t('Select optional modules'),
      'type' => 'form',
      'function' => ModuleConfigureForm::class,
    ],
  ] + array_slice($tasks, $insert_before - 1, NULL, TRUE);
}