- Issue created by @solideogloria
- First commit to issue fork.
- π¬π§United Kingdom catch
This is related to π AJAX MessageCommand markup and styling differs from Theme default Needs work but while I think we could make the AJAX command generate HTML, actually setting messages from js (if anything uses this) won't be able to, so should be in its own issue.
- πΊπΈUnited States mattc321
I extend my own MessageCommand to make this easier to reuse, but here is a direct simplified work around, returning a proper status message. Of course, many ways to do this while we await the fix in 3396318 π AJAX MessageCommand markup and styling differs from Theme default Needs work
public function myControllerResponseOrAjaxCallback() { $build = [ '#theme' => 'status_messages', '#message_list' => [ 'error' => [ '#markup' => t('An error occurred!'), ] ], '#status_headings' => [ 'status' => t('Status message'), 'error' => t('Error message'), 'warning' => t('Warning message'), ], ]; $output = \Drupal::service('renderer')->render($build); $response = new AjaxResponse(); $response->addCommand(new MessageCommand($output)); return $response; }