Object Oriented Drupal

brendoncrawford - September 2, 2008 - 19:43

This module is not in active development, but is intended as a proof of concept for developers interested in OOP practices within Drupal 6.

BEFORE USING THIS MODULE, PLEASE READ THE ONLINE DOCUMENTATION. THANKS.

The Droopal module offers out of the box support for writing modules in full OOP and accessing other modules via OOP. While not all developers wish to have this functionality, this module is targeted at those who do. Here are some examples of what you can do out of the box, all with zero configuration:

Access any core module using OOP:

<?php
  ModNode
::load()
?>

This would be the equivalent of:

<?php
  node_load
()
?>

Access any core include using OOP:

<?php
  LibCommon
::drupal_add_css()
?>

This would be the equivalent of:

<?php
  drupal_add_css
();
?>

Access any non-core module or include using OOP:

<?php
  ModImagecache
::action_save
?>

This would be the equivalent of:

<?php
  imagecache_action_save
()
?>

Write custom modules using OOP structures:

<?php
 
class ModMyModule {
   
// hook_menu
   
function menu() {
     
//etc...
   
}
   
// hook_nodeapi
   
function nodeapi() {
     
//etc...
   
}
  }
?>

The functionality to make this work is completely hidden and offered at virtually no performance hit. All existing Drupal APIs also remain completely intact.

Releases

Official releasesDateSizeLinksStatus
6.x-1.22008-Sep-1415.91 KBRecommended for 6.xThis is currently the recommended release for 6.x.
Development snapshotsDateSizeLinksStatus
6.x-1.x-dev2008-Sep-1416.39 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.


 
 

Drupal is a registered trademark of Dries Buytaert.