You are here

function domain_configure_form in Domain Access 7.3

Same name and namespace in other branches
  1. 5 domain_admin.inc \domain_configure_form()
  2. 6.2 domain.admin.inc \domain_configure_form()
  3. 7.2 domain.admin.inc \domain_configure_form()

FormsAPI for configuring the domain module.

2 string references to 'domain_configure_form'
domain_configure in ./domain.admin.inc
Module settings and behaviors.
domain_settings_add_element in domain_settings/domain_settings.module
Helper function to test if a form has to display the domain-specific settings, based on 'domain_settings' settings the user defined.

File

./domain.admin.inc, line 178
Administration functions for the domain module.

Code

function domain_configure_form($form, &$form_state, $user_submitted = FALSE) {
  $form['domain_sitename_override'] = array(
    '#type' => 'checkbox',
    '#title' => t('Override site name with name of domain.'),
    '#default_value' => variable_get('domain_sitename_override', 1),
    '#description' => t('When enabled, the site name is overridden with the domain name set on the domain edit page.'),
  );
  $form['domain_debug'] = array(
    '#type' => 'radios',
    '#title' => t('Debugging status'),
    '#required' => TRUE,
    '#default_value' => variable_get('domain_debug', 0),
    '#options' => array(
      0 => t('Do not show debugging output'),
      1 => t('Show debugging output on node view'),
    ),
    '#description' => t('If set, users with the <em>set domain access</em> permission will be able to view the node access rules for each node. See the README for more details.'),
  );
  $form['domain_force_admin'] = array(
    '#type' => 'radios',
    '#title' => t('Enforce rules on administrators'),
    '#required' => TRUE,
    '#default_value' => variable_get('domain_force_admin', 0),
    '#options' => array(
      0 => t('Do not enforce'),
      1 => t('Restrict node views for administrators'),
    ),
    '#description' => t('If set, users with the <em>administer nodes</em> permission and user 1 <em>will view the site with Domain Access restrictions enforced</em>. See the README for more details.'),
  );
  $form['domain_list_size'] = array(
    '#type' => 'select',
    '#title' => t('Domain list size'),
    '#required' => TRUE,
    '#default_value' => variable_get('domain_list_size', DOMAIN_LIST_SIZE),
    '#options' => drupal_map_assoc(array(
      5,
      10,
      20,
      25,
      30,
      40,
      50,
      75,
      100,
      150,
      200,
      250,
      500,
      750,
      1000,
    )),
    '#description' => t('Sets a break point for the size of domain lists shown to users. After this point, user interfaces will use tables, pagination, and select lists to prevent too many domains from appearing in a list. <em>Note: setting this value higher than 200 may cause memory and display issues for your site.</em>'),
  );
  $form['domain_vertical_tab'] = array(
    '#type' => 'radios',
    '#title' => t('Display in vertical tabs'),
    '#required' => TRUE,
    '#default_value' => variable_get('domain_vertical_tab', 0),
    '#options' => array(
      t('No'),
      t('Yes'),
    ),
    '#description' => t('Present the domain form options in a vertical tab.'),
  );
  $form['domain_collapse_options'] = array(
    '#type' => 'radios',
    '#title' => t('Collapse domain form options'),
    '#required' => TRUE,
    '#default_value' => variable_get('domain_collapse_options', 0),
    '#options' => array(
      t('No'),
      t('Yes'),
    ),
    '#description' => t('When not displayed in a vertical tab, collapse the domain form options fieldset.'),
  );
  $form['domain_select_format'] = array(
    '#type' => 'select',
    '#title' => t('Domain selection format'),
    '#required' => TRUE,
    '#default_value' => domain_select_format(),
    '#options' => array(
      t('Checkboxes'),
      t('Select list'),
    ),
    '#description' => t('Determines the display format of form elements that display domain lists.'),
  );
  $form['domain_advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['domain_advanced']['domain_www'] = array(
    '#type' => 'radios',
    '#title' => t('WWW prefix handling'),
    '#default_value' => variable_get('domain_www', 0),
    '#options' => array(
      0 => t('Process all host requests normally'),
      1 => t('Treat www.*.example.com as an alias of *.example.com'),
    ),
    '#description' => t('If set, calls to www.* will be treated as if the www. did not exist.
    <em>Users will be taken from www.example.com to example.com, so your domains must be registered without the www. prefix.</em>'),
  );
  $form['domain_advanced']['domain_search'] = array(
    '#type' => 'radios',
    '#title' => t('Search settings'),
    '#default_value' => variable_get('domain_search', 0),
    '#options' => array(
      0 => t('Search content for the current domain only'),
      1 => t('Search all domains from any URL'),
    ),
    '#description' => t('Options for content searching.'),
  );
  $form['domain_advanced']['domain_seo'] = array(
    '#type' => 'radios',
    '#title' => t('Search engine optimization'),
    '#default_value' => variable_get('domain_seo', 0),
    '#options' => array(
      0 => t('Do not rewrite URLs'),
      1 => t('Rewrite all URLs to point to a single source'),
    ),
    '#description' => t('If rewrite is turned on, all node links will point to a single instance of the node.  This
      option reduces the chance that search engines will recognize duplicate content.'),
  );
  $form['domain_advanced']['domain_edit_on_primary'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force domain editing from the primary domain'),
    '#default_value' => variable_get('domain_edit_on_primary', 1),
    '#description' => t('When editing a domain, you will be redirected to the primary domain. Doing so ensures that
      the server can handle changes to the domain record. <br /><em>Disabling this feature may make development environments
      easier to support. Use at your own risk.</em>'),
  );
  $options = array(
    '-1' => t('Do not change domain'),
  );
  foreach (domain_domains() as $data) {

    // The domain must be valid.
    if ($data['valid']) {
      $options[$data['domain_id']] = $data['sitename'];
    }
  }
  $form['domain_advanced']['domain_default_source'] = array(
    '#type' => 'select',
    '#title' => t('Default source domain'),
    '#options' => $options,
    '#default_value' => variable_get('domain_default_source', 0),
    '#description' => t('When rewriting urls, nodes assigned to all affiliates will be sent to this domain. <em>NOTE: This option only fires if you enable SEO rewrites or use the Domain Source module.</em>'),
  );
  $form['domain_all'] = array(
    '#type' => 'fieldset',
    '#title' => t('Special page requests'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['domain_all']['domain_grant_all'] = array(
    '#type' => 'textarea',
    '#rows' => 5,
    '#cols' => 40,
    '#default_value' => variable_get('domain_grant_all', "user/*/track"),
    '#description' => t('Content on these pages should be viewable on any domain.  Enter one path per line.
      You may use the * as a wildcard.  Use this for aggregate pages like those provided by <a href="!url">MySite</a> or if you
      intend to show all user posts on a specific page.  See the README for more details.', array(
      '!url' => 'http://drupal.org/project/mysite',
    )),
  );
  $form['domain_all']['domain_cron_rule'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('domain_cron_rule', 1),
    '#title' => t('Treat cron.php as a special page request.'),
    '#description' => t('Normally, you should leave this setting active.  See the README for more information.'),
  );
  $form['domain_all']['domain_xmlrpc_rule'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('domain_xmlrpc_rule', 0),
    '#title' => t('Treat xmlrpc.php as a special page request.'),
    '#description' => t('Enable this setting if you have trouble with remote data calls over XMLRPC.  See the README for more information.'),
  );
  $form['domain_paths'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node link patterns'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['domain_paths']['domain_paths'] = array(
    '#type' => 'textarea',
    '#rows' => 5,
    '#cols' => 40,
    '#default_value' => variable_get('domain_paths', "node/%n\r\nnode/%n/edit\r\ncomment/reply/%n\r\nnode/add/book/parent/%n\r\nbook/export/html/%n\r\nnode/%n/outline"),
    '#description' => t('When using SEO or other path rewrites, the following link paths should be turned into absolute URLs.  Enter
      the Drupal path of the link, using the <em>%n</em> placeholder to represent the node id.
      Enter one path per line.  See the README for more details.'),
  );
  $form['domain_classes'] = array(
    '#type' => 'fieldset',
    '#title' => t('Domain-specific CSS classes'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['domain_classes']['domain_classes'] = array(
    '#type' => 'textarea',
    '#rows' => 5,
    '#cols' => 40,
    '#default_value' => variable_get('domain_classes', 'domain-[current-domain:machine_name]'),
  );
  if (module_exists('token')) {
    $form['domain_classes']['domain_classes']['#description'] = t('Add the following classes to the <em>body</em> tag of every page. Enter one class per line. This field supports tokens.');
    $form['domain_classes']['token_help'] = array(
      '#theme' => 'token_tree',
      '#token_types' => array(
        'current-domain',
      ),
      '#global_types' => FALSE,
    );
  }
  else {
    $tokens = domain_get_tokens(array(
      'current-domain',
    ));
    $form['domain_classes']['domain_classes']['#description'] = t('Add the following classes to the <em>body</em> tag of every page. Enter one class per line. The following token replacements are allowed: !tokens', array(
      '!tokens' => theme('item_list', array(
        'items' => $tokens,
      )),
    ));
  }

  // Allow submodules to add elements to the form.
  $modules = module_implements('domain_form');
  if (!empty($modules)) {
    foreach ($modules as $module) {
      $func = $module . '_domain_form';
      $func($form);
    }
  }
  return system_settings_form($form);
}