AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Drupal devel dd9/18/2023 ![]() ![]() ![]() If you prefer a proper debugger then look at Xdebug. If you’re looking for something simple then use Kint. Then you should be able to navigate to classes by clicking on the reference while pressing command or control.Īs you can see, you have options when it comes to debugging. Once you’ve downloaded these plugins, enable them and then enable “Symfony integration”. However, if you install these three PhpStorm plugins, you’ll be able to navigate to the class or method by pressing command or control then clicking on the reference. There’s no easy way to navigate to the NodeController other than searching for the class name. _title_callback: 'DrupalnodeControllerNodeController::addPageTitle' _controller: 'DrupalnodeControllerNodeController::add' Make sure you turn on the integration by searching for “drupal” in the Preferences section.ĭrupal 8 uses the YAML format for a lot of things throughout its code base services, routing, permissions, etc…Īnd in these files you’ll see references to classes and methods. No longer will you have to remember a specific hook and its arguments. PhpStorm also offers Drupal integration and when enabled it allows autocomplete functionality for hooks. Learn how to configure Xdebug in PhpStorm. You can also see what variables are available. Using PhpStorm, you can add a breakpoint somewhere in PHP code and step through as the Drupal request is executed. It integrates nicely with Xdebug and the Drupal code base. PhpStorm is a commercial IDE which is popular with PHP and Drupal developers. Use the HTML comments to figure out which Twig template you should override and its file name. The debug: true parameter turns on Twig’s debugging, Twig will display information such as which template it used and its path. Then add the following into : parameters: To turn on Twig debugging, make sure you follow the link above. Most of this caching can be turned off by disabling them in a settings file.ĭ has a good page: “ Disable Drupal 8 caching during development”. You don’t want to rebuild the site cache every time you make a change in a template or a rendered array. This makes Drupal 8 fast, but it can complicate things when you’re writing code. Individual rendered elements like a block for example will be cached. Drupal Settingsĭrupal 8 caches a lot more things than Drupal 7. The two that I found most useful are router:debug and container:debug. Just search for any command with the term “debug”. It can be used to provision new Drupal sites, generate boilerplate code and debug Drupal.ĭrupal Console comes with a bunch of debug commands. It’s implemented using the Symfony Console component. Drupal Consoleĭrupal Console is a CLI tool for Drupal. If you want to learn more about Web Profiler, check out our tutorial on using Web Profiler in Drupal 8. The toolbar gives valuable insight into what’s happening in your Drupal site. The Web Profiler sub-module adds a toolbar at the bottom of your site and displays useful stats about the number of queries, memory usage and more. Ĭlick here to learn how to use Kint in Drupal 8. You can also print variables in Twig templates using. This module integrates the Kint library into Drupal and allows you to print variables using the PHP functions: ksm() and kint(). The two sub-modules worth mentioning are Kint and Web Profiler. It comes with a bunch of helper functions for module developers and it has a few handy sub-modules. I'm able to insert an if statement when this happens within that function as this: if($template_file = '.tpl.PHP has two handy functions which can be used to print variables, objects and arrays to the screen.ĭrupal core comes with its own function: debug().ĭevel has been around for as long as I’ve been using Drupal. It's complaining that theme_render_template() can't find a template file as the variable given to the function is just. Warning: include(/home/xxx/public_html/.tpl.php): failed to open stream: No such file or directory in theme_render_template() (line 1534 of /home/xxx/public_html/includes/theme.inc). The error breaks all of my views on the site when it happens and throws the following error: I'm able to finally get ddebug_backtrace() to run when the error happens. It happens randomly on my site as it's hard to reproduce. I've been trying to debug a weird bug on Drupal 7 for awhile. ![]()
0 Comments
Read More
Leave a Reply. |