You are here

function farm_install_optional_modules in farmOS 7

Callback function for installing optional farmOS modules via Batch API.

1 string reference to 'farm_install_optional_modules'
farm_install_configure_form_submit in ./farm.install
Submit function for farmOS configuration install task form.

File

./farm.install, line 191
farmOS install file.

Code

function farm_install_optional_modules() {

  // Load the list of modules to install.
  $modules = variable_get('farm_install_optional_modules', array());

  // Load list of module names.
  $files = system_rebuild_module_data();

  // Start an array of batch operations.
  $operations = array();

  // Add operation to enable selected modules.
  foreach ($modules as $module => $enable) {
    if (!empty($enable)) {
      $operations[] = array(
        '_farm_install_enable_module',
        array(
          $module,
          $files[$module]->info['name'],
        ),
      );
    }
  }

  // Assemble the Batch API.
  $batch = array(
    'title' => t('Installing optional modules'),
    'operations' => $operations,
  );

  // Return the Batch API.
  return $batch;
}