You are here

function ajax_ui_admin in Ajax 6

Display admin form

Return value

Assoc

1 string reference to 'ajax_ui_admin'
ajax_ui_menu in ajax_ui/ajax_ui.module
hook_menu

File

ajax_ui/ajax_ui.module, line 138

Code

function ajax_ui_admin() {
  $settings = variable_get('ajax', NULL);
  $types = ajax_ui_get_types();
  $options = ajax_ui_get_options();
  $form = array(
    'submit' => array(
      '#type' => 'submit',
      '#value' => t('Submit'),
    ),
    '#admin_options' => $options,
  );
  foreach ($types as $type => $name) {
    $form['types'][$type] = array(
      '#value' => $name,
    );
    $form['checkboxes'][$type] = array(
      '#type' => 'checkboxes',
      '#default_value' => array(),
      '#options' => array(),
    );
    foreach ($options as $option_k => $option_v) {
      $form['checkboxes'][$type]['#options'][$option_k] = '';

      // set default val for checkbox
      if ($settings !== NULL) {
        if (array_key_exists($type, $settings['types']['default'])) {
          if (array_key_exists($option_k, $settings['types']['default'][$type])) {
            if ($settings['types']['default'][$type][$option_k]) {
              $form['checkboxes'][$type]['#default_value'][$option_k] = $option_k;
            }
          }
        }
      }
    }
  }
  return $form;
}