You are here

function services_admin_settings in Services 6.2

Same name and namespace in other branches
  1. 5 services.module \services_admin_settings()
  2. 6 services_admin_browse.inc \services_admin_settings()
  3. 7 services_admin_browse.inc \services_admin_settings()

Build the admin settings form.

Return value

FAPI array

See also

services_admin_settings_submit()

1 string reference to 'services_admin_settings'
services_menu in ./services.module
Implementation of hook_menu().

File

./services_admin_browse.inc, line 284
Browser thru all services and servers.

Code

function services_admin_settings() {
  $auth_modules = module_implements('authentication_info');

  // Add security options.
  if (!empty($auth_modules)) {
    $auth_options = array(
      '' => t('-- Select an authentication module'),
    );
    foreach ($auth_modules as $module) {
      $info = services_auth_info(NULL, $module);
      services_strip_hashes($info);
      $auth_options[$info['description']][$module] = $info['title'];
    }
    $form['authentication'] = array(
      '#title' => t('Authentication'),
      '#type' => 'fieldset',
      '#description' => t('Changing authentication settings will require you to adjust all method calls. This will affect all applications using site services.'),
    );
    $form['authentication']['auth_module'] = array(
      '#type' => 'select',
      '#title' => t('Authentication module'),
      '#options' => $auth_options,
      '#required' => FALSE,
      '#default_value' => variable_get('services_auth_module', ''),
      '#ahah' => array(
        'path' => 'admin/services/ahah/security-options',
        'wrapper' => 'security-module-options',
        'method' => 'replace',
      ),
    );

    // Placeholder for the auth module options
    // also used as wrapper for ahah.
    $form['authentication']['options'] = array(
      '#prefix' => '<div id="security-module-options">',
      '#suffix' => '</div>',
      'settings' => array(
        '#value' => sprintf('<div class="description">%s</div>', t('Select an authentication module.')),
      ),
    );

    // Get the configuration form for the authentication module
    $settings = services_auth_invoke('security_settings');
    if (is_array($settings)) {
      $form['authentication']['options']['settings'] = $settings;
    }
  }
  else {

    // Warn if no authentication module has been installed.
    drupal_set_message(t('No authentication modules have been installed'), 'warning');
  }
  $form['services_use_content_permissions'] = array(
    '#type' => 'checkbox',
    '#title' => t('Apply content permissions'),
    '#default_value' => variable_get('services_use_content_permissions', FALSE),
    '#description' => t('CCK includes the optional Content Permissions module, which allows administrators to restrict access to content at the field level. By default, node services do NOT apply these permissions, causing all fields to be returned in all cases. Checking this box causes content permissions to be applied to node services.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
  );
  return $form;
}