Last active
August 7, 2019 13:58
-
-
Save imghasemi/fef6241cf9309dc595891cdd65b3d258 to your computer and use it in GitHub Desktop.
Drupal status message with AJAX for Drupal 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$response = new AjaxResponse(); | |
$status_messages = array('#type' => 'status_messages'); | |
$messages = \Drupal::service('renderer')->renderRoot($status_messages); | |
if (!empty($messages)) { | |
$response->addCommand(new PrependCommand('.your_selector', $messages)); | |
} | |
return $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment