You are here

public function FlexiformUIController::overviewForm in Flexiform 7

Builds the entity overview form.

Overrides EntityDefaultUIController::overviewForm

File

./flexiform.admin.inc, line 25
Model type editing UI.

Class

FlexiformUIController
UI controller.

Code

public function overviewForm($form, &$form_state, $conditions = array()) {
  $collapsed = TRUE;
  $tags = array();
  if (!empty($_GET['tags'])) {
    $tags = $conditions['tags'] = drupal_explode_tags($_GET['tags']);
    $collapsed = FALSE;
  }
  $form['filter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Filter'),
    '#collapsible' => TRUE,
    '#collapsed' => $collapsed,
  );
  $form['filter']['#id'] = 'flexiform-filter-form';
  $form['filter']['tags'] = array(
    '#title' => t('Filter by tag'),
    '#type' => 'textfield',
    '#default_value' => drupal_implode_tags($tags),
    '#autocomplete_path' => 'admin/structure/flexiforms/autocomplete_tags',
  );
  $groups = flexiform_get_groups();
  if (count($groups) > 0) {
    $form['filter']['form_group'] = array(
      '#title' => t('Filter by group'),
      '#type' => 'select',
    );
    foreach ($groups as $group => $info) {
      $form['filter']['form_group']['#options'][$group] = $info['label'];
    }
  }
  $form['filter']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Filter'),
    '#name' => '',
  );

  // Overridden to allow the passing of conditions through.
  $form['table'] = $this
    ->overviewTable($conditions);
  $form['pager'] = array(
    '#theme' => 'pager',
  );
  $form['#method'] = 'get';
  $form['#submit'][] = 'flexiform_form_submit_rebuild';
  return $form;
}