mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Fix for plugins extending admin-ui. Record ID was missing in 'create' mode. $id is now sent as a separate parameter to the "process" method. See e107_plugins/social/e_admin.php for an example.
This commit is contained in:
parent
72aa50b7d7
commit
e83b0c531a
@ -4071,7 +4071,13 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
// Scenario I - use request owned POST data - toForm already executed
|
||||
$model->setPostedData($_posted, null, false, false) // insert() or update() dbInsert();
|
||||
->save(true);
|
||||
|
||||
|
||||
|
||||
|
||||
// if(!empty($_POST))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Scenario II - inner model sanitize
|
||||
//$this->getModel()->setPosted($this->convertToData($_POST, null, false, true);
|
||||
@ -4081,7 +4087,9 @@ class e_admin_controller_ui extends e_admin_controller
|
||||
{
|
||||
// callback (if any)
|
||||
$new_data = $model->getData();
|
||||
$id = $model->getId();
|
||||
$id = $model->getId();
|
||||
|
||||
e107::getAddonConfig('e_admin',null,'process', $this, $id);
|
||||
|
||||
// Trigger Admin-ui event. 'post'
|
||||
if($triggerName = $this->getEventTriggerName($_posted['etrigger_submit'],'after')) // 'created' or 'updated';
|
||||
@ -4272,10 +4280,7 @@ class e_admin_ui extends e_admin_controller_ui
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
e107::getAddonConfig('e_admin',null,'process', $this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1873,7 +1873,7 @@ class e107
|
||||
* @param string $methodName [optional] (if different from 'config')
|
||||
* @return array
|
||||
*/
|
||||
public static function getAddonConfig($addonName, $className = '', $methodName='config', $param=null )
|
||||
public static function getAddonConfig($addonName, $className = '', $methodName='config', $param=null,$param2=null )
|
||||
{
|
||||
$new_addon = array();
|
||||
|
||||
@ -1896,7 +1896,7 @@ class e107
|
||||
include_once(e_PLUGIN.$key.'/'.$filename.'.php');
|
||||
|
||||
$class_name = $key.'_'.$className;
|
||||
$array = self::callMethod($class_name, $methodName,$param);
|
||||
$array = self::callMethod($class_name, $methodName,$param,$param2);
|
||||
|
||||
if($array)
|
||||
{
|
||||
@ -1915,10 +1915,11 @@ class e107
|
||||
* Safe way to call user methods.
|
||||
* @param string|object $class_name
|
||||
* @param string $method_name
|
||||
* @param string $param
|
||||
* @param mixed $param -1st parameter sent to method
|
||||
* @param mixed $param2 - 2nd parameter sent to method
|
||||
* @return array|bool FALSE
|
||||
*/
|
||||
public static function callMethod($class_name, $method_name, $param='')
|
||||
public static function callMethod($class_name, $method_name, $param=null, $param2=null)
|
||||
{
|
||||
$mes = e107::getMessage();
|
||||
|
||||
@ -1941,7 +1942,7 @@ class e107
|
||||
{
|
||||
$mes->addDebug('Executing <strong>'.$class_name.' :: '.$method_name.'()</strong>');
|
||||
}
|
||||
return call_user_func(array($obj, $method_name),$param);
|
||||
return call_user_func(array($obj, $method_name),$param, $param2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,10 +57,14 @@ class social_admin
|
||||
* Process Posted Data.
|
||||
* @param $ui admin-ui object
|
||||
*/
|
||||
public function process($ui)
|
||||
public function process($ui, $id=0)
|
||||
{
|
||||
$data = $ui->getPosted();
|
||||
$action = $ui->getAction(); // current mode: create, edit, list
|
||||
//e107::getHybridAuth('twitter');
|
||||
e107::getMessage()->addDebug("e107_plugins/social/e_admin.php :: process method called.");
|
||||
e107::getMessage()->addDebug("ID: ".$id);
|
||||
e107::getMessage()->addDebug("Action: ".$action);
|
||||
e107::getMessage()->addDebug(print_a($data,true));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user