57

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 __DIR__ . '/settings.local.php'; } and then copying the file example.settings.local.php from /sites folder to /sites/default folder and rename it to settings....


36

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 bundle is it. The logic of that Exception is: // Explicitly fail for malformed entities missing the bundle property. if (!isset($entity->{$info['entity keys']...


35

Good god Batman. That was incredibly frustrating. Here's a guide to getting xhprof working. (Note: I am very new to Linux. I'm not sure if the permissions I use are safe, or whether there is a better way of doing it. I'd only do this on a test environment.) IMPORTANT: It won't tell you anything about how to interpret it. I have no idea how to, I'm just ...


29

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. Added a "theme_hook_original" variable to templates and theme functions and an optional sitewide theme debug mode, to provide contextual information in the page'...


18

You can use the Devel module, and select one of the "Krumo Backtrace" options it provides in its configuration page at admin/config/development/devel. Make sure to visit admin/config/development/logging and select "Errors and Warnings" or "All Messages". If you have the Syslog module, or any other logging module enabled, you may need to disable it and ...


18

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.


16

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:mode prod.


16

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.0.1. Kint no longer comes with Devel, you'll need to do composer require kint-php/kint and apply patch. Important: in order to use kint() in a twig file you ...


15

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 your page.tpl.php anymore. Maybe you can add it back.


14

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. watchdog( 'my_module_name', 'Here is the printed variable: <pre>@placeholder_name</pre>', array('@placeholder_name' => print_r( $my_variable, ...


14

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="{{ fields.field_image.content|render|striptags|trim }}"></span></a> If you want to save (not delete) for example div or img tags you can also write: ...


13

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 template_preprocess_views_view_field(), while trying to output the content of a row, on a clean and fresh Drupal 8 installation. I found a workaround for kint(), ...


12

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 details for each one : /** * Error reporting level: display no errors. */ const ERROR_REPORTING_HIDE = 'hide'; /** * Error reporting level: display errors and ...


11

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 terminal that might make it easier to get this working if someone revisited it. If you want to exec Drush from within php, it is generally better to use ...


11

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 you the route and the controller class. You can start there. You can also search your code base for that route name and see, if there are additional cases when ...


10

dpm() does not print any protected properties and it also doesn't know about methods. That's especially bad for content entities but applies to most objects in 8.x now. The issue referenced in the answer from Daniel Wehner adds Kint, which is already much better, as it will give you protected properties and methods. However, for content entities, it still ...


10

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.


10

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 users. The core drupal message system as offered by drupal_set_message is an excellent way for modules to send out messages to the end users. However not all drupal ...


9

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 you have a nice clean page where you can send your debug messages, and not worry about race-type conditions where your messages might get cleared before you ...


9

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/reports and look for "log_name".


9

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 already is an issue https://www.drupal.org/node/2405179 to make this a configurable setting. In devel/kint/kint/config.default.php change 7 to any number you are ...


8

The best thing I've found: https://drupal.org/project/devel_debug_log Part of/depends on Devel and uses ddl to output anything in kpr fashion at admin/reports/debug.


8

Thanks to Clive comments, I solved the issue as following. Added ddebug_backtrace() where error occured (entity_extract_ids(), line 7700 of .\includes\common.inc ) to print the function call stack. Then looking for anything unexpected in output, I found that a pane visibility rule might be the problem. 19: ctools_entity_field_value_ctools_access_check() (...


8

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


8

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 almost 1:1 to accessing those values on an object, e.g. $entity->field_name->property. A few things are not shown there, for example computed properties like ->...


7

Edit the User module main file; find the user_access() function, add 2 lines before the return statement, and monitor the PHP error log. $granted = isset($perm[$account->uid][$string]); error_log(sprintf('--- user_access: %s "%s" = %s', $account->name, $string, $granted ? 'yes' : 'no')); return isset($perm[$account->uid][$string]);


7

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 investigate. I think you must have private file path set. you could use something like this, But be careful about XSS! $export = var_export($var, TRUE) // TRUE will ...


7

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") altogether. If this does not work for you, you should make a report in the Drush issue queue on GitHub.


7

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 );


7

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.


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