You are here

function acquia_agent_settings_form in Acquia Connector 6

Same name and namespace in other branches
  1. 6.2 acquia_agent/acquia_agent.pages.inc \acquia_agent_settings_form()
  2. 7.3 acquia_agent/acquia_agent.pages.inc \acquia_agent_settings_form()
  3. 7 acquia_agent/acquia_agent.pages.inc \acquia_agent_settings_form()
  4. 7.2 acquia_agent/acquia_agent.pages.inc \acquia_agent_settings_form()

Settings form builder function.

1 string reference to 'acquia_agent_settings_form'
acquia_agent_settings_form_page in acquia_agent/acquia_agent.pages.inc
Menu callback for settings page.

File

acquia_agent/acquia_agent.pages.inc, line 501
Acquia Agent configuration page.

Code

function acquia_agent_settings_form($form_state, $banner) {
  $identifier = acquia_agent_settings('acquia_identifier');
  $key = acquia_agent_settings('acquia_key');

  // Help for copying the identifier and key.
  $copy_help = t('Copy from <a href="@subscriptions-overview">your subscriptions overview on the Acquia Network</a>.', array(
    '@subscriptions-overview' => 'http://network.acquia.com/network/dashboard/subscription',
  ));
  $form['cs'] = array(
    '#type' => 'fieldset',
    '#title' => t('Acquia Network keys'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['cs']['acquia_identifier'] = array(
    '#type' => 'textfield',
    '#title' => t('Identifier'),
    '#default_value' => $identifier,
    '#description' => $copy_help,
    '#required' => TRUE,
  );
  $form['cs']['acquia_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Key'),
    '#default_value' => $key,
    '#description' => $copy_help,
    '#required' => TRUE,
  );
  $form['cs']['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save keys'),
    '#validate' => array(
      'acquia_agent_set_validate',
    ),
    '#submit' => array(
      'acquia_agent_set_submit',
    ),
  );
  $form['cs']['buttons']['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Clear keys'),
    '#access' => !empty($identifier) || !empty($key),
    '#submit' => array(
      'acquia_agent_delete_submit',
    ),
  );
  $ssl_available = in_array('ssl', stream_get_transports(), TRUE) && !defined('ACQUIA_DEVELOPMENT_NOSSL');
  $form['ssl'] = array(
    '#type' => 'fieldset',
    '#title' => t('SSL settings'),
    '#collapsible' => FALSE,
  );
  $form['ssl']['acquia_agent_verify_peer'] = array(
    '#type' => 'radios',
    '#title' => t('Enhanced SSL security'),
    '#default_value' => (int) (variable_get('acquia_agent_verify_peer', 0) && $ssl_available),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
    '#description' => t('If enabled the Acquia Connector will attempty to verify Acquia server identities before sending data.  May cause communication to fail, however, depending on your local configuration.'),
    '#disabled' => !$ssl_available,
  );
  if ($ssl_available) {
    $form['ssl']['acquia_agent_verify_peer']['#description'] .= ' <div class="ok">' . t('PHP has SSL support and may support this feature.') . '</div>';
    $form['ssl']['buttons']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save configuration'),
      '#submit' => array(
        'acquia_agent_ssl_submit',
      ),
    );
  }
  else {
    $form['ssl']['acquia_agent_verify_peer']['#description'] .= ' <div class="error">' . t('PHP does not have SSL support.') . '</div>';
  }
  $form['banner'] = array(
    '#value' => $banner,
  );
  $form['#theme'] = 'acquia_agent_banner_form';
  return $form;
}