class Analyze

Same name and namespace in other branches
  1. 11.x core/modules/views_ui/src/Form/Ajax/Analyze.php \Drupal\views_ui\Form\Ajax\Analyze

Displays analysis information for a view.

@internal

Hierarchy

Expanded class hierarchy of Analyze

2 string references to 'Analyze'
Analyze::buildForm in core/modules/views_ui/src/Form/Ajax/Analyze.php
Analyze::getFormKey in core/modules/views_ui/src/Form/Ajax/Analyze.php

File

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

Namespace

Drupal\views_ui\Form\Ajax
View source
class Analyze extends ViewsFormBase {
  
  /**
   * {@inheritdoc}
   */
  public function getFormKey() {
    return 'analyze';
  }
  
  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'views_ui_analyze_view_form';
  }
  
  /**
   * {@inheritdoc}
   */
  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;
  }
  
  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    /** @var \Drupal\views_ui\ViewUI $view */
    $view = $form_state->get('view');
    $form_state->setRedirectUrl($view->toUrl('edit-form'));
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.