atr_form_profile

Versions
6.1
atr_form_profile(&$form_state, $profile = NULL)

Form builder; edit a settings profile.

Code

atr/includes/atr.admin.inc, line 239

<?php
function atr_form_profile(&$form_state, $profile = NULL) {
  include_once './includes/locale.inc';
  drupal_add_js(drupal_get_path('module', 'atr') . '/js/atr.js');

  $form['#redirect'] = 'atr/profile';
  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title'),
    '#default_value' => $profile->title,
    '#required' => TRUE,
  );
  $form['language'] = array(
    '#type' => 'item',
    '#title' => t('Text language'),
    '#value' => atr_language_profile($profile->language),
  );

  // Render a fieldset and 'Enable' checkbox for every review method.
  $methods_info = module_invoke_all('atr_method_info');
  foreach (array_keys($methods_info) as $method) {
    if ($method_info = atr_method_availability($method, $profile->language)) {
      $form[$method] = array(
        '#type' => 'fieldset',
        '#title' => $method_info['#title'],
        '#description' => isset($method_info['#description']) ? $method_info['#description'] : NULL,
      );
      $form[$method][$method . '-toggle'] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable @review_method', array('@review_method' => $method_info['#title'])),
        '#default_value' => in_array($method, $profile->methods),
        '#attributes' => array(
          'class' => 'atr-settings-toggle',
        ),
      );
    }
    $form[$method]['settings'] = array(
      '#prefix' => '<div class="edit-' . $method . '-toggle js-hide">',
      '#suffix' => '</div>',
    );
  }

  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save profile'),
  );
  $form['profile'] = array(
    '#type' => 'value',
    '#value' => $profile,
  );

  return $form;
}
?>