Yes, the MakeForm class was originally a tool I created for MODx, and the version in xPDO requires MODx because it uses chunks to represent form element templates. It will be moved out of the xPDO project soon, and into the MODx 0.9.7 model where it belongs, along with the MakeTable class.
The simplest usage of it with xPDO could go something like this (though there are a lot of ways to use it, and this is just one approach)
1:
<?php
$object= $xpdo->getObject('myClass', $_REQUEST['uid']);
if (!$object) $object= $xpdo->newObject('myClass');
$xpdo->loadClass('form.MakeForm', XPDO_CORE_PATH, true, true);
$form= new MakeForm($xpdo);
$excludeFields= array ();
if ($_POST) {
if (isset ($_POST['save'])) {
$form->setFormObject($object, $excludeFields);
$saved= $form->processForm($object, $_POST);
}
}
$form->setFormObject($object, $excludeFields);
$form->formElements['save']= array (
'type' => 'submit',
'name' => 'save',
'value' => 'Save',
);
return $form->buildForm();
?>
You can also build the form elements an an array definition (this example automatically builds the elements based on the object meta data) manually, so you have more control over it. Likewise, you can process the form however you want; the processForm() method simply automates that for simple cases. There’s probably a lot more I can tell you about it, so please don’t hesitate to ask more questions...
1 Note that this requires the chunks to be added to MODx, or no elements will be rendered. You can get a set of sample chunks from the original MakeForm distribution here.