I've used drupal 8 with devel module. I want to change some values dynamically in views fields. So i tried to use theme_preprocess_views_view_fields(). When i tried to print variables using print_r(), kint() & dump(), no one print values.

 * Implement theme_preprocess_views_view_fields().
function galip_preprocess_views_view_fields(&$variables) {
  $view = $variables['view'];

I've enabled debug mode true in services.yml file. But i can't get any variables. How can i get variables?

  • I think the problem is, that this hook never got executed. Not all views preprocess hooks work with all views configurations. Did you try to do something else in the hook and see if it runs? (and always clear the cache when implementing a hook)
    – 4uk4
    Commented Dec 29, 2015 at 11:20

2 Answers 2


You should pass the object into the $variables array, and then in one of the Twig templates issue {{ dump(var) }}. Drupal might be using output buffering there, which would explain why you don't see any output when issuing those calls from the preprocess function.


Just include Kint debugger in your theme file:


and use Kint like so:

Kint::dump( $_SERVER );
  • 1
    Just enable Kint module, no need to require_once.
    – Nikit
    Commented May 15, 2018 at 2:40
  • 2
    I've found that for a page-level template_preprocess function I needed to do the above as well. Tried just ksm() but that just output in plain text and when I tried to use Kint::dump($variables) with Kint module enabled, it still said class Kint did not exist. Works with the require_once just before it though.
    – scotself
    Commented Dec 6, 2018 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.