Drupal module development: Introduction to Dev Tools
Although there are hundreds of Drupal website developers out there, not many know about Dev Tools module. To describe it in a nutshell, Dev Tools module is simply collection of PHP classes and functions that aid in Drupal module development atlanta. Let’s have a quick glance at what Dev Tools module is all about.
History of Dev Tools
Drupal developers accumulate lots of codes over time and use them during development of subsequent Drupal projects. However, these helper codes are often in a project-specific helper module and developers have to rename the module and all hooks and files associated with them to be used in new projects.
While this may not seem to be cumbersome for a tiny project, large projects that require many project name_foo, projectname_bar modules often result in a messy look of the folder structure. One other annoying job for Drupal developers, who do not have automation facility, is the constant need to write update hooks in order to enable or disable custom modules. This instigated the idea of Dev Tools so that a single module that compartmentalized all functionalities in a style similar to that of individual modules.
Main Dev Tool module and its principles
The main Dev Tool module file serves as a threshold to various individual components. The .module file comprises regular hooks, however, instead of implementing them on its own, Dev Tools returns the aggregate result of implementation of hooks within individual components to Drupal. Thus Drupal module developer atlanta considers it as a single module. Only if the hook exists within the main .module file can it be used.
Using Dev Tools
If you need to use the components of Dev Tools, it should be loaded from custom module file. The following illustrates the easiest way of doing this:
While the above code can load all of the components within the Dev Tools namespace, you can also load one or more individual components as follows:
Once this is done, simply calling the function names will enable you to take advantage of individual components. One tiny advantage with custom implementation is the possibility to override individual component function within Dev Tools by registering the name of the overriding function in a global variable.