You are here

function domain_conf_domainbatch in Domain Access 6.2

Same name and namespace in other branches
  1. 5 domain_conf/domain_conf.module \domain_conf_domainbatch()
  2. 7.2 domain_conf/domain_conf.module \domain_conf_domainbatch()

Implement hook_domainbatch()

File

domain_conf/domain_conf.module, line 171
Domain manager configuration options.

Code

function domain_conf_domainbatch() {
  $batch = array();

  // Allows the deletion of all Domain Configuration rows.
  $batch['domain_conf'] = array(
    '#form' => array(
      '#title' => t('Reset configurations'),
      '#type' => 'checkbox',
      '#options' => array(
        0 => 1,
        1 => t('Reset'),
      ),
      '#description' => t('Delete custom settings for this domain.'),
    ),
    '#domain_action' => 'domain_delete',
    '#system_default' => 0,
    '#variable' => 'domain_conf',
    '#meta_description' => t('Delete custom settings for domains as supplied by Domain Configuration.'),
    '#table' => 'domain_conf',
    '#weight' => -10,
  );

  // Change the email address.
  $batch['site_mail'] = array(
    '#form' => array(
      '#title' => t('Email address'),
      '#type' => 'textfield',
      '#size' => 40,
      '#maxlength' => 255,
      '#description' => t('Set the email address for this domain.'),
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('site_mail', ''),
    '#variable' => 'site_mail',
    '#meta_description' => t('Set the email address for all domains.'),
    '#data_type' => 'string',
    '#weight' => -8,
    '#update_all' => TRUE,
    '#group' => t('Site configuration'),
  );

  // Change the site slogan.
  $batch['site_slogan'] = array(
    '#form' => array(
      '#title' => t('Site slogan'),
      '#type' => 'textfield',
      '#size' => 60,
      '#maxlength' => 255,
      '#description' => t('The slogan of this domain. Some themes display a slogan when available.'),
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('site_slogan', ''),
    '#variable' => 'site_slogan',
    '#meta_description' => t('Set the site slogan for all domains.'),
    '#data_type' => 'string',
    '#weight' => -8,
    '#update_all' => TRUE,
    '#group' => t('Site configuration'),
  );

  // Change the site slogan.
  $batch['site_mission'] = array(
    '#form' => array(
      '#title' => t('Site mission'),
      '#type' => 'textarea',
      '#cols' => 30,
      '#rows' => 5,
      '#description' => t('The mission statement or focus for this domain.'),
    ),
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('site_mission', ''),
    '#variable' => 'site_mission',
    '#meta_description' => t('Set the site mission for all domains.'),
    '#data_type' => 'string',
    '#weight' => -8,
    '#update_all' => TRUE,
    '#group' => t('Site configuration'),
  );

  // Change the site footer.
  $batch['site_footer'] = array(
    '#form' => array(
      '#title' => t('Site footer'),
      '#type' => 'textarea',
      '#cols' => 30,
      '#rows' => 5,
      '#description' => t('This text will be displayed at the bottom of each page for this domain.'),
    ),
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('site_footer', ''),
    '#variable' => 'site_footer',
    '#meta_description' => t('Set the site footer for all domains.'),
    '#data_type' => 'string',
    '#weight' => -8,
    '#update_all' => TRUE,
    '#group' => t('Site configuration'),
  );

  // Change the site frontpage.
  $batch['site_frontpage'] = array(
    '#form' => array(
      '#title' => t('Site frontpage'),
      '#type' => 'textfield',
      '#size' => 30,
      '#maxlength' => 255,
      '#description' => t('The home page displays content from this relative URL. If unsure, specify "node".'),
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('site_frontpage', 'node'),
    '#variable' => 'site_frontpage',
    '#meta_description' => t('Set the site frontpage for all domains.'),
    '#data_type' => 'string',
    '#weight' => -8,
    '#update_all' => TRUE,
    '#group' => t('Site configuration'),
  );

  // Change the anonymous user name.
  $batch['anonymous'] = array(
    '#form' => array(
      '#title' => t('Anonymous user'),
      '#type' => 'textfield',
      '#size' => 30,
      '#maxlength' => 255,
      '#description' => t('The name used to indicate anonymous users for this domain.'),
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('anonymous', 'Anonymous'),
    '#variable' => 'anonymous',
    '#meta_description' => t('Set the anonymous user label for all domains.'),
    '#data_type' => 'string',
    '#weight' => -8,
    '#update_all' => TRUE,
    '#group' => t('Site configuration'),
  );

  // Change the administrative theme.
  $themes = list_themes();
  ksort($themes);
  $options[] = t('Use domain default theme');
  foreach ($themes as $key => $value) {
    $options[$key] = $key;
  }
  $batch['admin_theme'] = array(
    '#form' => array(
      '#title' => t('Administrative theme'),
      '#type' => 'select',
      '#options' => $options,
      '#description' => t('Select the administrative theme for this domain.'),
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('admin_theme', 0),
    '#variable' => 'admin_theme',
    '#meta_description' => t('Set the administrative theme for all domains.'),
    '#data_type' => 'string',
    '#weight' => -8,
    '#update_all' => TRUE,
    '#group' => t('Administrative theme'),
  );

  // Change the timezone.
  $zones = _system_zonelist();
  $batch['date_default_timezone'] = array(
    '#form' => array(
      '#title' => t('Timezone default'),
      '#type' => 'select',
      '#options' => $zones,
      '#description' => t('Select the default site time zone.'),
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('date_default_timezone', 0),
    '#variable' => 'date_default_timezone',
    '#meta_description' => t('Set the default timezone for all domains.'),
    '#data_type' => 'string',
    '#weight' => -6,
    '#update_all' => TRUE,
    '#group' => t('Timezone settings'),
  );

  // Change the caching mode.
  $batch['cache'] = array(
    '#form' => array(
      '#type' => 'radios',
      '#title' => t('Caching mode'),
      '#options' => array(
        CACHE_DISABLED => t('Disabled'),
        CACHE_NORMAL => t('Normal (recommended for production sites, no side effects)'),
      ),
      '#description' => t('Enabling the page cache will offer a significant performance boost. Drupal can store and send compressed cached pages requested by <em>anonymous</em> users. By caching a web page, Drupal does not have to construct the page each time it is viewed.') . '<em> ' . t('Aggressive mode caching is not supported when using Domain Access.') . '</em>',
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('cache', CACHE_DISABLED),
    '#variable' => 'cache',
    '#meta_description' => t('Set the page cache options for all domains.'),
    '#data_type' => 'integer',
    '#weight' => -5,
    '#update_all' => TRUE,
    '#group' => t('Performance'),
  );

  // Change the cache lifetime.
  $period = drupal_map_assoc(array(
    0,
    60,
    180,
    300,
    600,
    900,
    1800,
    2700,
    3600,
    10800,
    21600,
    32400,
    43200,
    86400,
  ), 'format_interval');
  $period[0] = '<' . t('none') . '>';
  $batch['cache_lifetime'] = array(
    '#form' => array(
      '#type' => 'select',
      '#title' => t('Minimum cache lifetime'),
      '#options' => $period,
      '#description' => t('On high-traffic sites, it may be necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will elapse before the cache is emptied and recreated, and is applied to both page and block caches. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.'),
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('cache_lifetime', 0),
    '#variable' => 'cache_lifetime',
    '#meta_description' => t('Set the minimum cache lifetime for all domains.'),
    '#data_type' => 'integer',
    '#weight' => -5,
    '#update_all' => TRUE,
    '#group' => t('Performance'),
  );

  //Add support of Pressflow external cache if available
  if (defined('CACHE_EXTERNAL')) {
    $batch['cache']['#form']['#options'][CACHE_EXTERNAL] = t('External (experts only, possible side effects)');
    $batch['page_cache_max_age'] = array(
      '#form' => array(
        '#type' => 'select',
        '#title' => t('Page cache maximum age'),
        '#options' => $period,
        '#description' => t('Internal and external page caches will not deliver cached paged older than this setting.'),
      ),
      '#domain_action' => 'domain_conf',
      '#system_default' => variable_get('page_cache_max_age', 0),
      '#variable' => 'cache_lifetime',
      '#meta_description' => t('Set the page cache maximum age for all domains.'),
      '#data_type' => 'integer',
      '#weight' => -4,
      '#update_all' => TRUE,
      '#group' => t('Performance'),
    );
  }

  // Change the page compression settings.
  $batch['page_compression'] = array(
    '#form' => array(
      '#type' => 'radios',
      '#title' => t('Page compression'),
      '#options' => array(
        t('Disabled'),
        t('Enabled'),
      ),
      '#description' => t("By default, Drupal compresses the pages it caches in order to save bandwidth and improve download times. This option should be disabled when using a webserver that performs compression."),
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('page_compression', TRUE),
    '#variable' => 'page_compression',
    '#meta_description' => t('Set the page compression status for all domains.'),
    '#data_type' => 'integer',
    '#weight' => -5,
    '#update_all' => TRUE,
    '#group' => t('Performance'),
  );

  // Toggle the site offline status.
  $batch['site_offline'] = array(
    '#form' => array(
      '#title' => t('Site status'),
      '#type' => 'radios',
      '#options' => array(
        t('Online'),
        t('Off-line'),
      ),
      '#description' => t('Toggle online/offline status.'),
    ),
    '#domain_action' => 'domain_conf',
    '#system_default' => variable_get('site_offline', 0),
    '#variable' => 'site_offline',
    '#meta_description' => t('Set the online / offline status for all domains.'),
    '#data_type' => 'integer',
    '#weight' => -4,
    '#update_all' => TRUE,
    '#group' => t('Site status'),
  );

  // Change the site offline message.
  $batch['site_offline_message'] = array(
    '#form' => array(
      '#title' => t('Site offline message'),
      '#type' => 'textarea',
      '#cols' => 30,
      '#rows' => 5,
      '#description' => t('Message to show visitors when this domain is in off-line mode.'),
    ),
    '#permission' => 'administer site configuration',
    '#domain_action' => 'domain_conf',
    '#system_default' => t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array(
      '@site' => variable_get('site_name', 'Drupal'),
    )),
    '#variable' => 'site_offline_message',
    '#meta_description' => t('Set the site offline message for all domains.'),
    '#data_type' => 'string',
    '#weight' => -2,
    '#update_all' => TRUE,
    '#group' => t('Site status'),
  );

  // Change the default language.
  if (module_exists('locale')) {
    $languages = domain_conf_language_options();
    $default = language_default();
    $batch['language_default'] = array(
      '#form' => array(
        '#title' => t('Default language'),
        '#type' => 'select',
        '#options' => $languages,
        '#description' => t('The default language to use for this domain. <em>Note: This setting only works with path-based language switching.</em>'),
      ),
      '#permission' => 'administer languages',
      '#domain_action' => 'domain_conf',
      '#system_default' => $default->language,
      '#override_default' => TRUE,
      '#variable' => '',
      // deliberately empty, since this is an array and cannot be set.
      '#meta_description' => t('Set the default language for all domains.'),
      '#data_type' => 'string',
      '#weight' => 6,
      '#update_all' => TRUE,
      '#group' => t('Language settings'),
      '#module' => t('Language'),
    );
  }

  // Change the menus
  if (module_exists('menu')) {
    $menus = menu_get_menus();
    $batch['menu_default_node_menu'] = array(
      '#form' => array(
        '#title' => t('Default menu for content'),
        '#type' => 'select',
        '#options' => $menus,
        '#description' => t('Choose the menu to be the default in the menu options in the content authoring form.'),
      ),
      '#permission' => 'administer menu',
      '#domain_action' => 'domain_conf',
      '#system_default' => variable_get('menu_default_node_menu', 0),
      '#variable' => 'menu_default_node_menu',
      '#meta_description' => t('Set the default menu options for the content authoring form in all domains.'),
      '#data_type' => 'string',
      '#weight' => 0,
      '#update_all' => TRUE,
      '#group' => t('Menu settings'),
      '#module' => t('Menu'),
    );
    $menus[0] = t('Do not use for this site');
    $batch['menu_primary_links_source'] = array(
      '#form' => array(
        '#title' => t('Primary links menu'),
        '#type' => 'select',
        '#options' => $menus,
        '#description' => t('Select the primary links for this site.'),
      ),
      '#permission' => 'administer menu',
      '#domain_action' => 'domain_conf',
      '#system_default' => variable_get('menu_primary_links_source', 0),
      '#variable' => 'menu_primary_links_source',
      '#meta_description' => t('Set the primary links menu in all domains.'),
      '#data_type' => 'string',
      '#weight' => 2,
      '#update_all' => TRUE,
      '#group' => t('Menu settings'),
      '#module' => t('Menu'),
    );
    $batch['menu_secondary_links_source'] = array(
      '#form' => array(
        '#title' => t('Secondary links menu'),
        '#type' => 'select',
        '#options' => $menus,
        '#description' => t('Select the secondary links for this site.'),
      ),
      '#domain_action' => 'domain_conf',
      '#system_default' => variable_get('menu_secondary_links_source', 0),
      '#variable' => 'menu_secondary_links_source',
      '#meta_description' => t('Set the secondary links menu in all domains.'),
      '#data_type' => 'string',
      '#weight' => 4,
      '#update_all' => TRUE,
      '#group' => t('Menu settings'),
      '#module' => t('Menu'),
    );
  }
  foreach ($batch as $key => $value) {
    if (!isset($batch[$key]['#module'])) {
      $batch[$key]['#module'] = t('Domain Configuration');
    }
  }
  return $batch;
}