public function ViewUI::buildFormState

Build up a $form_state object suitable for use with drupal_build_form based on known information about a form.

File

drupal/core/modules/views/views_ui/lib/Drupal/views_ui/ViewUI.php, line 821
Definition of Drupal\views_ui\ViewUI.

Class

ViewUI
Stores UI related temporary settings.

Namespace

Drupal\views_ui

Code

public function buildFormState($js, $key, $display_id, $args) {
  $form = views_ui_ajax_forms($key);

  // Build up form state
  $form_state = array(
    'form_key' => $key,
    'form_id' => $form['form_id'],
    'view' => &$this,
    'ajax' => $js,
    'display_id' => $display_id,
    'no_redirect' => TRUE,
  );

  // If an method was specified, use that for the callback.
  if (isset($form['callback'])) {
    $form_state['build_info']['args'] = array();
    $form_state['build_info']['callback'] = array(
      $this,
      $form['callback'],
    );
  }
  foreach ($form['args'] as $id) {
    $form_state[$id] = !empty($args) ? array_shift($args) : NULL;
  }
  return $form_state;
}