7 min

Drupal Debugging: 6 Ways to Debug Drupal 8

The story of Drupal 8 began back in 2011. Since then, thousands of web developers around the world have been looking forward to the release of a brand-new version of this well-known content management system. In November 2015, Drupal 8 was released and developers were able to explore its features to build new or improve the existing Drupal sites. The 8th Drupal version kept and significantly improved all the best features from the previous versions. This user-friendly tool provides new opportunities for data structuring, website customization, and content presentation. Besides that, it opens new mobile development and multilingual accessibility horizons. Powered by Symfony2, it is a great choice for web development. However, writing excellent Drupal code when providing custom Drupal development services is still immensely difficult, and getting it perfect the first time is almost impossible. You can save your project from most potential issues if you work independently. But if you are working with a large enterprise solution built by many Drupal developers over the years, you need to be an expert in Drupal 8 debugging techniques. Take a look at the best ways to improve your Drupal code and use this article as your Drupal debugging handbook! #1: Disable Cache in Drupal Settings Drupal 8 has expanded its functionality due to volumetric caching (rendered Twig templates and blocks) and Varnish as caching server for excellent performance. With every change we make, we run the risk of being forced to rebuild the Drupal site cache from scratch. Solutions? We know three ways to address Drupal 8 debug effectively: 1) Clear Cache It will allow you to visualize changes and progress. You can clear the cache manually every time by going along this path: Configuration - Performance - 'Clear all caches'. 2) Use Drupal Twig Debug Drupal 8 is enriched with an out-of-the-mode Twig debugging feature. You can enable Twig debugging to improve your code. Add a few lines of the following code either in the sites/default/service or development.service file. parameters: Why is Drupal Twig Debug Effective? search refinement (you can quickly determine which part of your HTML code was written in which Twig templates, by HTM comments) easy to find matching sentence Twig templates, and you can easily override them true parameter debug, which turns on the Twig debugging process and starts displaying the used Twig templates along with their paths 3) Drupal 8 Local Development Setup  Step 1. Copy the file /sites/example.settings.local.php to file /sites/default/settings.local.php This file already has the necessary settings. Step 2. In the file settings.php uncomment the following lines, this will include  created settings.local.php: Step 3. Check that this line is uncommented in settings.local.php:  The file has already been created, you only need to include it. Step 4. You also need to check that in settings.local.php CSS and Javascript aggregation are disabled: Step 5. You need to disable caching of rendered HTML and the cache of the Dynamic Pages module: Step 6. To prevent Drupal 8 from picking up tests from modules, you need to change the value of this setting to FALSE: Step 7. You need to add the following lines  to /sites/ yml: As a result, should look like this: Step 8. After that, you need to clear the cache, which can be done via Drush:drush cr In case this method wasn’t helpful enough, follow the next Drupal 8 debugging piece of advice.
Read more
10 min

Drupal Pros And Cons: Is It Right For You?

10 min

23 Famous Drupal Websites

10 min

How to Choose a Technology Stack for Digital Publishers to Boost the Business

4 min

AnyforSoft At DrupalCon 2022 in Portland

3 min

Stand with Ukraine!

How to Elevate Your E-Commerce Business with a Cutting-Edge App

Digital Media Business Models

9 min

Top 8 Crucial E-Commerce Integrations for Your Business

How to Migrate from WordPress to Drupal?

Want To Work With Us?