After following
Configuring NetBeans, a very informative post on Drupal, I could still not debug my module on NetBeans 8.1. My main problem was that the breakpoints set on any of my module's files appeared as broken. In order to fix this, I needed to let NetBeans know which server request calls the module's code.
The Server request
Using Chrome's "Inspect" feature on the /admin/modules page after enabling my module and submitting the form, I found out that the module installation was being initiated by a POST request to "http://.../admin/modules/list/confirm".
I had created an apache virtual site to host it. On NetBeans, I included the whole Drupal 7 web tree as the project source (var/www/drupal7), and modified the project's
Run Configuration accordingly (right click on the project's name > Properties):
|
Project Properties - Run Configuration |
On the Advanced... settings window, I added the following Path Mapping:
- Server Path: http://mylocalserver.local/admin/modules/list/confirm
- Project Path: click on the ... and browse to the directory where your module is installed: /var/www/drupal7/sites/all/modules/my_module
|
Project Properties - Run Configuration - Advanced... |
After this, the break points set on the files under .../my_module appeared and worked just fine.