[module] M00: a template for contributed modules

HOT TIP: this content is flagged as highly recommended !


Project page quote (external)
Project page quoted on: 

A template project designed as a starting point for other contributed modules. It aims to provide one of each of the features and capabilities you might require for contributed modules, ready to be adapted for a real project.

To adapt for your project, simply clone then replace the string 'm00' everywhere with your project/module machine name. The project name 'M00' and machine name 'm00' are chosen to afford easy find-and-replace substitution, where the 'm' stands for 'module'.

This is an actively maintained and evolving tutorial development project, with a live demonstration site home page:

- http://drupal7demo.webel.com.au/module/m00


This module requires:

- X Autoload, which is highly recommended for object-oriented projects (although this version of M00 is not object-oriented except for a Common class with shared constants).

[A fully object-oriented version of M00 ("M-zero-zero") called MOO ("M-oh-oh") is also being developed that leverages the Object Oriented Examples bridge for Drupal7 under development by Webel IT Australia. The version of M00 here is deliberately a "straight" Drupal7 version.]


- Install as you would normally install a contributed drupal module. See Installing modules (Drupal 7) for further information.

- To view the stub block just activate it under the block list for your theme at /admin/structure/block.

- To view the stub page enable the 'access m00 content' permission at /admin/people/permissions.


There is currently only one configuration parameter, a positive integer variable that is otherwise not used, except for display on the main page /m00. Configure it at: /admin/config/development/m00.

HOWTO adapt the m00 template project/module to start a new module

In the following replace 'mymodule' with your new module name.

In a parent folder for contributed module development copy the 'm00' template module folder recursively:

cp -R m00 mymodule
cd mymodule
IMPORTANT: you should perform the next steps before initialising the new module folder with Git !

From within your new 'mymodule' folder substitute all occurrences of 'm00' with 'mymodule'. The following (adapted from here and here and here and here) worked for me on Mac OS X:

find . -type f  \( -iname "*.install" -or -iname "*.module" -or -iname "*.php" -or -iname "*.inc" -or -iname "*.info" \) -exec sed -i -e 's/m[0][0]/mymodule/g' {} +

To rename the files this (adapted from here) worked for me on Mac OS X:

$ find . -type f  \( -iname "*.install" -or -iname "*.module" -or -iname "*.php" -or -iname "*.inc" -or -iname "*.info" \) -exec rename 's|m00|mymodule|' {} +

(If you want to do a dry run without changing the name use the -n flag on rename.)


- Edit the mymodule.info file and adapt as needed (and change the package from 'Tutorials').

- Edit the README.txt file, which will usually require substantial adaptation.


webel - http://drupal.org/user/392755

No other maintainers are currently sought.


Public WWW users can only see some parts of the module in operation at this demonstration page, or choose 'm00' form the Navigation menu at http://drupal7demo.webel.com.au/module/m00. There are some various unthemed and themed stub pages with associated tabs and/or nested menu items.

There is a special user forms access permission that is deliberately not enabled there, if you install it and enable it authorised users can also play with some stub user input forms.

A simple stub block for m00 should be visible in the right sidebar.


The M00 project/module template is developed by Webel IT Australia, specialists in PHP-driven Drupal CMS web engineering, UML, SysML, Java and XML. In addition to using Drupal CMS for developing clients' web sites, Webel has used Drupal CMS for many years to develop educational web sites promoting graphical software engineering with Unified Modeling Language (UML) and graphical systems engineering with Systems Modeling Language (SysML):

- http://www.webel.com.au

- http://drupal7demo.webel.com.au


If you are interesting in seeing M00 expanded to become a more substantial template for Drupal7 module development, or in seeing a Drupal8 version developed, please consider supporting the project. Donations to the M00 project may be made online via PayPal at: http://drupal7demo.webel.com.au/lm_paypal/donations