Get list of preprocess block variables How can I display a list of preprocess block variables so I can conditionally include a library? Using the 'plugin_id' doesn't seem to work and when I echo all of the variables all I see is a blank page. Is there a Drupal page that will show me what all the variables are for blocks?
My custom block module is called, 'leaflet_block'.
function leaflet_block_preprocess_block(&amp;$variables) {
  echo &quot;&lt;pre&gt;&quot;; print_r($variables); echo &quot;&lt;/pre&gt;&quot;; // shows a blank page

  if ($variables['plugin_id'] == 'leaflet_block') {
    $variables['#attached']['library'][] = 'leaflet_block/leaflet_block';
  }
}
echo &quot;&lt;pre&gt;&quot;; print_r($variables); echo &quot;&lt;/pre&gt;&quot;;

That's not how it should be done, instead, install the Devel module.
This will allow you to do:
dump($variables);

If you haven't turned caching off, for developing purposes, then you will have to flush all caches to see the dump.

In addition, if you also install the kint package/library with:
composer require kint-php/kint

now you could also do:
kint($variables);

Related: Welcome to Kint 101