You are here

function finder_ui_form in Finder 7.2

Form handler callback for finder_ui plugin.

More like a form alter of the one ctools_export_ui makes.

1 string reference to 'finder_ui_form'
finder_ui.inc in modules/finder_ui/plugins/export_ui/finder_ui.inc

File

modules/finder_ui/includes/finder.inc, line 112

Code

function finder_ui_form(&$form, &$form_state) {
  ctools_include('object-cache');
  $finder =& $form_state['item'];
  $finder
    ->build_elements();
  $finder
    ->defaults();
  if (empty($finder->title) || arg(6) == 'info') {
    $view_default_value = NULL;
    if (!empty($finder->views_view) && !empty($finder->views_display)) {
      $view_default_value = $finder->views_view . ':' . $finder->views_display;
    }
    $form['info']['title']['#title'] = t('Title');
    $form['info']['title']['#required'] = TRUE;
    unset($form['info']['title']['#description']);
    $form['info']['description']['#title'] = t('Description');
    $form['info']['view'] = array(
      '#type' => 'select',
      '#title' => t('View'),
      '#default_value' => $view_default_value,
      '#description' => t('The Views display of the potential results.'),
      '#required' => TRUE,
      '#options' => finder_ui_views(TRUE),
    );
    $form['actions']['submit']['#value'] = t('Continue');
  }
  else {
    unset($form['info']);
    $js_hide = " js-hide";
    $cached = ctools_object_cache_get('finder', $finder->name);
    if (!empty($cached)) {
      $finder = $cached;
      $js_hide = "";
    }
    $finder
      ->build_elements();
    $finder
      ->load_element_handlers();
    $form['changed'] = array(
      '#prefix' => '<div class="finder-changed messages warning form-wrapper' . $js_hide . '" id="edit-changed">',
      '#markup' => t('All changes are stored temporarily. Click Save to make your changes permanent. Click Cancel to discard your changes.'),
      '#suffix' => '</div>',
      '#weight' => 0,
    );
    $form['admin'] = finder_ui_page($finder);
  }
  if (!finder_ui_check_lock($finder)) {
    unset($form['actions']['submit']);
  }
}