You are here

public function Analyze::buildForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views_ui/src/Form/Ajax/Analyze.php \Drupal\views_ui\Form\Ajax\Analyze::buildForm()
  2. 9 core/modules/views_ui/src/Form/Ajax/Analyze.php \Drupal\views_ui\Form\Ajax\Analyze::buildForm()

File

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

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'] = [
    '#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;
}