1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Plugin builder now adds example beforeCreate, beforeUpdate, afterCreate and afterUpdate methods to generated php config file.

This commit is contained in:
Cameron
2015-02-03 12:24:15 -08:00
parent cec216c613
commit 685374e4a2

View File

@@ -2273,8 +2273,9 @@ class pluginBuilder
$options = array( $options = array(
'text' => "Text Box", 'text' => "Text Box",
'textarea' => "Text Area",
'bbarea' => "Rich-Text Area", 'bbarea' => "Rich-Text Area",
'boolean' => "Text Area", 'boolean' => "True/False",
"method" => "Custom Function", "method" => "Custom Function",
"image" => "Image", "image" => "Image",
); );
@@ -3197,7 +3198,6 @@ if($_POST['pluginPrefs'][0]['index'])
{ {
$text .= " $text .= "
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'), 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'),
"; ";
} }
@@ -3283,9 +3283,9 @@ class ".$table." extends e_admin_ui
// protected \$batchCopy = true; // protected \$batchCopy = true;
// protected \$sortField = 'somefield_order'; // protected \$sortField = 'somefield_order';
// protected \$orderStep = 10; // protected \$orderStep = 10;
// protected \$tabs = array('Tabl 1','Tab 2'); // Use 'tab'=>0 OR 'tab'=>1 in the \$fields below to enable. // protected \$tabs = array('Tabl 1','Tab 2'); // Use 'tab'=>0 OR 'tab'=>1 in the \$fields below to enable.
// protected \$listQry = \"SELECT * FROM #tableName WHERE field != '' \"; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit. // protected \$listQry = \"SELECT * FROM `#tableName` WHERE field != '' \"; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit.
protected \$listOrder = '".$vars['pid']." DESC'; protected \$listOrder = '".$vars['pid']." DESC';
@@ -3341,8 +3341,45 @@ $text .= "
$text .= " $text .= "
} }
// ------- Customize Create --------
public function beforeCreate(\$new_data)
{
return \$new_data;
}
public function afterCreate(\$new_data, \$old_data, \$id)
{
// do something
}
public function onCreateError(\$new_data, \$old_data)
{
// do something
}
// ------- Customize Update --------
public function beforeUpdate(\$new_data, \$old_data, \$id)
{
return \$new_data;
}
public function afterUpdate(\$new_data, \$old_data, \$id)
{
// do something
}
public function onUpdateError(\$new_data, \$old_data, \$id)
{
// do something
}
/* /*
// optional - override edit page. // optional - a custom page.
public function customPage() public function customPage()
{ {
\$ns = e107::getRender(); \$ns = e107::getRender();