1
0
mirror of https://github.com/e107inc/e107.git synced 2025-05-03 10:49:12 +02:00

Issue #3695 e_admin addon - list mode with custom methods fixed.

This commit is contained in:
Cameron 2019-03-04 12:41:10 -08:00
parent 037c7c67ff
commit b5032c2477
4 changed files with 55 additions and 40 deletions

View File

@ -7564,39 +7564,6 @@ class e_admin_form_ui extends e_form
}
/**
* Interface e_admin_addon_interface @move to separate addons file?
*/
interface e_admin_addon_interface
{
/**
* Return a list of values for the currently viewed list page.
* @param string $event
* @param string $ids comma separated primary ids to return in the array.
* @return array with primary id as keys and array of fields key/pair values.
*/
public function load($event, $ids);
/**
* Extend Admin-ui Parameters
* @param $ui admin-ui object
* @return array
*/
public function config(e_admin_ui $ui);
/**
* Process Posted Data.
* @param $ui admin-ui object
* @param int $id
*/
public function process(e_admin_ui $ui, $id=0);
}

View File

@ -2394,6 +2394,7 @@ class e107
* @param string $pluginName e.g. faq, page
* @param string $addonName eg. e_cron, e_url, e_module
* @param mixed $className [optional] true - use default name, false - no object is returned (include only), any string will be used as class name
* @param mixed $param [optional] construct() param
* @return object
*/
public static function getAddon($pluginName, $addonName, $className = true)
@ -5175,4 +5176,40 @@ class e107
}
e107::autoload_register(array(e107::class, 'autoload'));
e107::autoload_register(array(e107::class, 'autoload'));
/**
* Interface e_admin_addon_interface @move to separate addons file?
*/
interface e_admin_addon_interface
{
/**
* Return a list of values for the currently viewed list page.
* @param string $event
* @param string $ids comma separated primary ids to return in the array.
* @return array with primary id as keys and array of fields key/pair values.
*/
public function load($event, $ids);
/**
* Extend Admin-ui Parameters
* @param $ui admin-ui object
* @return array
*/
public function config(e_admin_ui $ui);
/**
* Process Posted Data.
* @param $ui admin-ui object
* @param int $id
*/
public function process(e_admin_ui $ui, $id=0);
}

View File

@ -5559,15 +5559,25 @@ var_dump($select_options);*/
$meth = (!empty($attributes['method'])) ? $attributes['method'] : $method;
if(method_exists($this,$meth))
if(strpos($meth,'::')!==false)
{
$parms['field'] = $field;
$mode = (!empty($attributes['mode'])) ? $attributes['mode'] :'read';
$value = call_user_func_array(array($this, $meth), array($value, $mode, $parms));
list($className,$meth) = explode('::', $meth);
$cls = new $className();
}
else
{
$className = get_class($this);
$cls = $this;
}
if(method_exists($cls,$meth))
{
$parms['field'] = $field;
$mode = (!empty($attributes['mode'])) ? $attributes['mode'] :'read';
$value = call_user_func_array(array($cls, $meth), array($value, $mode, $parms));
}
else
{
$className = get_class($cls);
e107::getDebug()->log("Missing Method: ".$className."::".$meth." ".print_a($attributes,true));
return "<span class='label label-important label-danger'>Missing Method</span>";
}

View File

@ -5040,4 +5040,5 @@ class e107plugin
}
}
?>