58 votes
Accepted

How do I enable developer/debug mode?

On a development site I would suggest uncommenting the following lines in the settings.php file. emacs sites/default/settings.php if (file_exists(__DIR__ . '/settings.local.php')) { include ...
  • 6,523
36 votes

How to debug EntityMalformedException?

The error: EntityMalformedException: Missing bundle property on entity of type node. happens, because your bundle property is malformed either on load or save, so Drupal can't find what type of ...
  • 13.7k
29 votes

Is there any alternative to devel themer?

Not really. Since Drupal 7.33 release there is now simple support for alternative template support and themeing function alternatives listing in Drupal (core) by adding a setting in settings.php. ...
  • 18.3k
20 votes

How do I enable developer/debug mode?

Add the following line in the settings.php file. $config['system.logging']['error_level'] = 'verbose'; See Make developer tricks / tools for D8 more discoverable/obvious for more details.
  • 2,224
16 votes

dpm() does not display any results on screen

Sometimes krumo($variable) might work when dpm($variable) doesn't. Sometimes print dpm($variable) might work when dpm($variable) doesn't. might also be the solution when there's no print $messages in ...
  • 16.2k
16 votes

How do I enable developer/debug mode?

An easy option, if you have access to Drupal Console, is to enable the development/debugging environment using drupal site:mode dev; when you are ready to change it back to production, use drupal site:...
  • 4,701
16 votes
Accepted

In Drupal 7 how do you output array objects to be view able in watchdog error reports?

You can use watchdog but the message part should be translatable, so any variables should use placeholders defined in the variables array. Check out format_string to see how these should work. ...
16 votes
Accepted

How to stop twig debug from breaking HTML when inside tags?

You can apply |render|striptags|trim twig filters: <a href="{{ fields.path.content|render|striptags|trim }}" class="menu-item">{{ fields.title.content }}<span data-background-image="{{ ...
16 votes

What is easiest way to debug variables in nodes, views, blocks and page twig templates?

What is easiest way to debug variables in nodes,views,blocks and page template Welcome to Kint 101 Installing Using Kint with Devel 8.x-2.1, which comes with the Devel module. Using Kint with Devel 4....
  • 29.8k
13 votes

How do I enable developer/debug mode?

Here is the variable with the different values : $config['system.logging']['error_level'] = 'all'; // hide|some|all|verbose These error levels are defined in the Drupal Core Bootstrap, here is the ...
13 votes
Accepted

dump() not working in Drupal 8 (blank page, debbugging is enabled)

I agree with the comment left for the question: It seems you have an out of memory issue. Check the error log for the server. I had the same problem with dump() and kint() in an implementation of ...
  • 1,288
12 votes

execute drush command from devel/php drupal

Someone tried to create a module to provide shell access from within a Drupal site, but it was never fully debugged. See the Drupal Terminal project. Perhaps there have been advances in the jQuery ...
12 votes

Debug "Access Denied"

Install the devel module and then Web Profile module which is bundled with it. You will then see the Symfony web profiler bar below the browser screen. Click on a Request gear icon, and it will show ...
10 votes

How to show all template suggestions for a page without using Devel Themer?

You can put this in your settings.php $conf['theme_debug'] = true; This outputs html comments on your page which will help you with debugging how the theme suggestions are selected.
  • 288
10 votes
Accepted

How to show messages starting with "Debug : " to an administrator only?

Option 1: Use the Disable Messages module Use the Disable Messages module for this. Here is a quote from its project page: Gives a site owner options to disable specific messages shown to end ...
9 votes

dpm() does not display any results on screen

I'd highly recommend devel_debug_log. It requires the devel module, and it gives you the ddl() function. ddl adds a page to your reports in configuration, so it's similar to printing to watchdog, but ...
9 votes

In Drupal 7 how do you output array objects to be view able in watchdog error reports?

You can do the following to output array data to be viewed in watchdog: // Directly use values. watchdog("log_name", '<pre>' . print_r( $my_object, true) . '</pre>'); Then goto /admin/...
9 votes

How to make use of Devel debugging functions on large or complex objects

The first problem can temporarily get fixed by changing the max array/object levels Kint will go deep. Currently this still has to be done by changing one line of code in the module. Though there ...
  • 16.2k
8 votes

Why is ddebug_backtrace coming up blank?

For me the command had to be called without the extra d dpm(debug_backtrace());
8 votes
Accepted

How to make use of Devel debugging functions on large or complex objects

When working with entities and fields, you want to see the values, not the objects. For an entity, use $entity->toArray(), for a field object, use $field->getValue(). You can transform that ...
  • 81.7k
7 votes
Accepted

Devel output on hooks called during cron run

You should use the function dd() to log something during cron. Here is the doc: https://api.drupal.org/api/devel/devel.module/function/dd/7 It will log the output to a file, which later you can ...
  • 994
7 votes
Accepted

How to get drush to work with xdebug -- may have recently broken

The former drush script is still available as drush.launcher. I would recommend making this your entrypoint when using Drush with xdebug, and omit the drush "finder" script (called simply "drush") ...
7 votes

dump(), kint() & print_r() are not working in .theme file

Just include Kint debugger in your theme file: require_once('modules/devel/kint/kint/Kint.class.php'); and use Kint like so: Kint::dump( $_SERVER );
  • 219
7 votes

How do I print the SQL query of a view in front end?

You can enable on "Show the SQL query" and "Show other queries run during render during live preview" on "www.example.com/admin/structure/views/settings" Hope it will help you.
  • 1,308
7 votes

How do I print the SQL query of a view in front end?

While you could install webprofiler module, if you've already got a custom module, it might be quicker to do this: /** * Implements hook_views_post_execute(). */ function ...
  • 663
7 votes
Accepted

How can I log variables to a txt file?

The DevelDumperManagerInterface interface is implemented by DevelDumperManager. This class is in turn used as a service, 'devel.dumper'. One way to use this function would be the following: $ddumper = ...
7 votes
Accepted

How to use kpr() or dsm() when i am not logged in

You need to grant the Access developer information permission to the anonymous user role. Be sure to revoke it again before releasing the site, it's an easy way to leak sensitive information.
  • 164k
6 votes

execute drush command from devel/php drupal

As kalidasan suggests, you could use the exec() function, to do something like: exec("drush fra -y", $output); var_dump($output); Normally, devel will run this command where the settings.php is ...
  • 878
6 votes
Accepted

dump(), kint() & print_r() are not working in .theme file

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 ...
6 votes
Accepted

Copy path to variable in array using Kint

It seemed there was no solution so I just copied the search_krumo module and changed it a bit so it works with Drupal 8 and kint and made search_kint. I've only just done the first push so isn't ...
  • 6,393

Only top scored, non community-wiki answers of a minimum length are eligible