formatMessages example

$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} */
  
Home | Imprint | This part of the site doesn't use cookies.