DMC aka PHP Framework
Categories
Component ID
1439604
Component name
DMC aka PHP Framework
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
Drupal Module Classes.
This is my way to return something to the community.
The goal of this project is allow the developer to create new modules using pure PHP objects syntax instead of arrays.
Page & Form
You can create a page and a form using the following syntax:
DMC::import('DMCMenuItem', 'DMCPage', 'DMCForm', 'DMCFormItems');
class ExamplePage extends DMCPage implements DMCMenu
{
public static function getMenuItem()
{
$menu = new DMCMenuItem('dmc/example-page', __CLASS__);
$menu->setTitle('My cute example page');
return $menu;
}
function construct()
{
$this->items = '<p>This is a sample page.</p>';
}
}
class ExampleForm extends DMCForm implements DMCMenu
{
public static function getMenuItem()
{
$menu = new DMCMenuItem('dmc/example-form', __CLASS__, FALSE);
$menu->setTitle('My cute example form');
return $menu;
}
function construct()
{
$this->add(new DMCFormTextBox('name', 'Your name'));
$this->add(new DMCFormSelect('age', 'Age range', array(
18 => '18-20',
21 => '21-39',
40 => '40-59',
60 => '60 or more'
)));
$this->add(new DMCFormButton('ok', 'Send'));
}
}
If you're using an IDE with code completion, like Netbeans, you'll get help on each class method.
