How to preserve kint output upon form submit redirection? I've attached a custom submit handler to node add/edit form for the article content type:

$form['actions']['publish']['#submit'][] = 'my_module_node_edit_submit';


In the handler, I am trying to inspect the form state values with kint (via the devel module):

kint($form_state-&gt;getValues());


Upon submission of the form, I'm able to briefly see the kint output on the screen, but I am also presented with this message:


  Redirecting to http://localhost/example.com/node/123


The page then redirects back to view the node, and the kint output is gone. How can I preserve the kint output so it is available after the redirection?
Use ksm() instead of kint().

I ran into the same issue when I want to inspect the entity after saving, using drupal's hook_entity_presave and kint

I found this article on how to print variables using kint() which explains that ksm() prints the output inside the drupal page (not before as kint()) does. 

So this example prints the entity without redirecting:

function mymodule_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
  ksm($entity-&gt;toArray());
}