You are here

function hosting_settings in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 hosting.module \hosting_settings()
  2. 7.4 hosting.module \hosting_settings()

General settings form.

2 string references to 'hosting_settings'
hosting_menu in ./hosting.module
Implements hook_menu().
hosting_platform_form_alter in platform/hosting_platform.module
Hide the delete button on platform nodes.

File

./hosting.module, line 1317
Hosting module.

Code

function hosting_settings($form, &$form_state) {
  $form['settings'] = array(
    '#type' => 'item',
    '#title' => t('General Hosting settings'),
    '#value' => t('Here you may set various general settings that apply to site management or to the frontend system.'),
    '#weight' => 0,
  );
  $profiles = array();
  foreach (hosting_get_profiles() as $id => $name) {
    $profile = hosting_package_instance_load(array(
      'p.nid' => $id,
    ));
    $profiles[$profile->short_name] = theme('hosting_site_profile', array(
      'profile' => $profile,
      'html' => '',
    ));

    // Don't allow a site to be provisioned a restricted profile.
    if (in_array($name, array(
      'Hostslave',
      'Hostmaster',
    ))) {
      unset($profiles[$profile->short_name]);
    }
  }
  natcasesort($profiles);
  $default_value = hosting_package_instance_load(array(
    'p.nid' => hosting_get_default_profile(),
  ))->short_name;
  $form['hosting_default_profile'] = array(
    '#type' => 'select',
    '#title' => t('Default profile'),
    '#options' => $profiles,
    '#description' => t('The default install profile to use when creating new sites.'),
    '#default_value' => $default_value,
  );
  $form['hosting_ignore_default_profiles'] = array(
    '#type' => 'checkbox',
    '#title' => t('Hide platforms with non-default profiles'),
    '#description' => t('When selecting a Drupal core profile, hide platforms that also contain other profiles (i.e intended as distributions). Warning: requires a platform other than the Hostmaster platform.'),
    '#default_value' => variable_get('hosting_ignore_default_profiles', FALSE),
  );
  $form['hosting_lock_platforms_by_default'] = array(
    '#type' => 'checkbox',
    '#title' => t('Lock platforms by default on initial creation'),
    '#description' => t("When verifying a new platform, set its initial state to 'Locked'. This can avoid having sites created on a new platform before there has been a chance to test it. Those users with the 'create sites on locked platforms' permission (e.g., with the 'platform manager' role) will still be able to build sites."),
    '#default_value' => variable_get('hosting_lock_platforms_by_default', FALSE),
  );
  $form['hosting_platform_automatic_site_import'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically import sites when verifying platforms'),
    '#description' => t("When verifying a platform, if sites are found that do not yet exist in the front-end, automatically import them."),
    '#default_value' => variable_get('hosting_platform_automatic_site_import', TRUE),
  );
  $form['hosting_require_disable_before_delete'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require site to be disabled before deletion'),
    '#description' => t('Check if you wish for users to run the Disable task on a site prior to running the Delete task.'),
    '#default_value' => variable_get('hosting_require_disable_before_delete', TRUE),
  );
  $form['hosting_delete_force'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force sites, platforms, and servers to be removed when running the Delete task.'),
    '#description' => t('If something goes wrong when deleting a site, platform, or server, the task will fail. Check this box to force contexts to be removed when Delete tasks are run.'),
    '#default_value' => variable_get('hosting_delete_force', FALSE),
  );
  if (hosting_feature('cron')) {
    $form['hosting_cron_use_backend'] = array(
      '#type' => 'radios',
      '#title' => t('Cron method'),
      '#description' => t('For running cron on a site. You can use the drush cron implementation or the web-based cron.php method using builtin HTTP requests. The drush implementation is more reliable but will be slower than the web-based approach if the webserver has an opcode cache (like APC) configured.'),
      '#options' => array(
        'Web-based',
        'Drush',
      ),
      '#default_value' => variable_get('hosting_cron_use_backend', TRUE),
    );
  }
  $types = hosting_log_types();
  $form['hosting_task_logs_types_display'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Task Logs to Display'),
    '#description' => t('Select the types of logs you wish to show to the user.'),
    '#options' => $types,
    '#default_value' => variable_get('hosting_task_logs_types_display', $types),
  );
  return system_settings_form($form);
}