R – How does AOP apply to Drupal

aopdrupal

How does AOP (Aspect Oriented Programming) work in Drupal?

I have learned about AOP in terms of using it for logging and security, but how does it apply to Drupal?

Best Answer

Drupal mimics AOP paradigms through hooks, which basically allow developers to weave in bits of code during the flow of execution. You can take a look at the hooks a developer can implement on the list of Drupal hooks shown in the Drupal documentation site, which just lists the hooks invoked from Drupal core and its modules.

As a quick example, if I were developing a new node based module (nodes being the basic data form in Drupal), I have instant access to comments and taxonomy with no additional work on my part. the comment and taxonomy modules have the ability to hook into nodes, and provide that added functionality. So in that sense, I don't have to account for such features in my program but I am able to take advantage of that flexibility.

Related Topic