Here's how you can customise a module to add custom functionality around the edit form, by sub-classing the WebMatEdit class.
In your module, look for the file
/inc/item_edit.inc
If this file does not exist, for example in a new custom module, then you need to create it.
You need to create the class that extends WebMATEdit
class RegistrationsItemWebMATEdit extends WebMATEdit
{
}
There are a number of functions in WebMATEdit and it's parent classes such as WebMATItem that are provided as hooks for custom code.
Here is example code using these hook functions for a hypothetical registrations module.
<?php
/**
* Registrations edit class
*
* @package Registrations
*/
class RegistrationsItemWebMATEdit extends WebMATEdit
{
private $debug = true;
/**
* Override here to change the module toolbar links
*/
function editTableLinks(& $links, $id, $item) {
global $USER;
// if (!$this->db_functions->isClosed($id)) {
// bcrm_unset($links, 'Delete');
// }
// $links['Registrations'] = array(
// 'href' => 'confirm.php', //$this->getFileSetHref($this->edit_link),
// 'text' => 'Confirm registration',
// 'icon' => 'page_misc.png',
// 'title' => 'Confirm'
// );
}
/**
* any processing required before adding to the form is created
* this is an opportunity to alter the data definition
*/
function beforeForm(&$id, &$item, &$error_msg) {
global $SERVICES;
//$this->dd->changeAttributes(array('field_key' => 'id', 'label' => 'A new label'));
}
/**
* do further processing after the submit has completed
*/
function doSubmitEnd($id) {
//here is the data array
//print_r($this->item);
//temp
if (1) {
//do stuff
}
}
/**
* go somewhere else after completing
*/
function doRedirect($id) {
print ("<h3>Landing page with will be here</h3>");
//header('Location: my_page.php');
exit();
}
}
?>