3 namespace Drupal\views_ui\Form\Ajax;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\views\Views;
9 * Displays analysis information for a view.
11 class Analyze extends ViewsFormBase {
16 public function getFormKey() {
23 public function getFormId() {
24 return 'views_ui_analyze_view_form';
30 public function buildForm(array $form, FormStateInterface $form_state) {
31 $view = $form_state->get('view');
33 $form['#title'] = $this->t('View analysis');
34 $form['#section'] = 'analyze';
36 $analyzer = Views::analyzer();
37 $messages = $analyzer->getMessages($view->getExecutable());
40 '#prefix' => '<div class="js-form-item form-item">',
41 '#suffix' => '</div>',
42 '#markup' => $analyzer->formatMessages($messages),
45 // Inform the standard button function that we want an OK button.
46 $form_state->set('ok_button', TRUE);
47 $view->getStandardButtons($form, $form_state, 'views_ui_analyze_view_form');
54 public function submitForm(array &$form, FormStateInterface $form_state) {
55 /** @var $view \Drupal\views_ui\ViewUI */
56 $view = $form_state->get('view');
57 $form_state->setRedirectUrl($view->urlInfo('edit-form'));