Analyze.php in Drupal 9
File
core/modules/views_ui/src/Form/Ajax/Analyze.php
View source
<?php
namespace Drupal\views_ui\Form\Ajax;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Views;
class Analyze extends ViewsFormBase {
public function getFormKey() {
return 'analyze';
}
public function getFormId() {
return 'views_ui_analyze_view_form';
}
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),
];
$form_state
->set('ok_button', TRUE);
$view
->getStandardButtons($form, $form_state, 'views_ui_analyze_view_form');
return $form;
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$view = $form_state
->get('view');
$form_state
->setRedirectUrl($view
->toUrl('edit-form'));
}
}
Classes
Name |
Description |
Analyze |
Displays analysis information for a view. |