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:
@@ -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'),
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
@@ -3285,7 +3285,7 @@ class ".$table." extends e_admin_ui
|
|||||||
// 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();
|
||||||
|
Reference in New Issue
Block a user