hook_ajax_render_alter(array &$data)
Alter the Ajax command data that is sent to the client.
\Drupal\Core\Ajax\CommandInterface[] $data: An array of all the rendered commands that will be sent to the client.
function hook_ajax_render_alter(array &$data) { // Inject any new status messages into the content area. $status_messages = array('#type' => 'status_messages'); $command = new \Drupal\Core\Ajax\PrependCommand('#block-system-main .content', \Drupal::service('renderer')->renderRoot($status_messages)); $data[] = $command->render(); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Form!form.api.php/function/hook_ajax_render_alter/8.1.x