Analyze::buildForm

public Analyze::buildForm(array $form, FormStateInterface $form_state)

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

core/modules/views_ui/src/Form/Ajax/Analyze.php, line 30

Class

Analyze
Displays analysis information for a view.

Namespace

Drupal\views_ui\Form\Ajax

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $view = $form_state->get('view');

  $form['#title'] = $this->t('View analysis');
  $form['#section'] = 'analyze';

  $analyzer = Views::analyzer();
  $messages = $analyzer->getMessages($view->getExecutable());

  $form['analysis'] = array(
    '#prefix' => '<div class="js-form-item form-item">',
    '#suffix' => '</div>',
    '#markup' => $analyzer->formatMessages($messages),
  );

  // Inform the standard button function that we want an OK button.
  $form_state->set('ok_button', TRUE);
  $view->getStandardButtons($form, $form_state, 'views_ui_analyze_view_form');
  return $form;
}
doc_Drupal
2016-10-29 08:44:26
Comments
Leave a Comment

Please login to continue.