DrupalOop
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
The DrupalOop module is a simple backend OOP structure for building modules in Drupal 7. The idea is to write modules and other custom Drupal components as PHP Objects as simply as possible. This allows for PHPUnit testing to be more easily applied to Drupal 7 code and provides helper methods for actions that are module specific.
To keep things simple, there is no dependecy on anything Drupal 8. You don't need composer or to know what PSR-4 is. Everything is done using Drupal 7 standards.
This module is still in a development phase, so large changes to the structure are still possible, but the base has mostly settled.
Current Supported Components
- Modules
- Blocks
- Text Filters
Creating a Module
Creating a module works the same with DrupalOop as any normal module. You need a .info and a .module file. With DrupalOop, you can create an object to contain your module-specific functionality and register it to Drupal like any other file.
awesome_sauce.info
name = Awesome Sauce
...
dependencies[] = drupaloop
files[] = src/AwesomeSauceModule.php
awesome_sauce.module
/**
* @file
* This module is awesome. And saucy.
*/
// Implement regular Drupal hooks here, but offload custom logic to the module class.
src/AwesomeSauceModule.php
class AwesomeSauceModule extends DrupalModule {
// Do your stuff here
}
