mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +02:00
Fixes #5464 - admin-ui fatal error with custom method attribute and method type and filter set to true.
This commit is contained in:
@@ -8780,29 +8780,48 @@ class e_admin_form_ui extends e_form
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'method':
|
case 'method':
|
||||||
$method = $key;
|
|
||||||
$list = call_user_func_array(array($this, $method), array('', $type, $parms));
|
|
||||||
|
|
||||||
if(is_array($list))
|
$method = !empty($val['method']) ? $val['method'] : $key; // Use the method attribute if specified, otherwise fall back to the field key
|
||||||
|
|
||||||
|
if(strpos($method, '::') !== false)
|
||||||
{
|
{
|
||||||
//check for single option
|
list($className, $methodName) = explode('::', $method);
|
||||||
if(isset($list['singleOption']))
|
$cls = new $className();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cls = $this;
|
||||||
|
$methodName = $method;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(method_exists($cls, $methodName))
|
||||||
|
{
|
||||||
|
$list = call_user_func_array(array($cls, $methodName), array('', $type, $parms));
|
||||||
|
if(is_array($list))
|
||||||
{
|
{
|
||||||
$textsingle .= $list['singleOption'];
|
// Check for single option
|
||||||
|
if(isset($list['singleOption']))
|
||||||
|
{
|
||||||
|
$textsingle .= $list['singleOption'];
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
// options array
|
||||||
|
foreach($list as $k => $name)
|
||||||
|
{
|
||||||
|
$option[$key . '__' . $k] = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(!empty($list))
|
||||||
|
{
|
||||||
|
$text .= $list;
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
// non rendered options array
|
|
||||||
foreach($list as $k => $name)
|
|
||||||
{
|
|
||||||
$option[$key.'__'.$k] = $name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
elseif(!empty($list)) //optgroup, continue
|
else
|
||||||
{
|
{
|
||||||
$text .= $list;
|
e107::getDebug()->log('Missing Method: ' . get_class($cls) . '::' . $methodName);
|
||||||
continue 2;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'user': // TODO - User Filter
|
case 'user': // TODO - User Filter
|
||||||
|
|
||||||
|
@@ -61,12 +61,12 @@ class _blank_event // plugin-folder + '_event'
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function myfunction($data) // the method to run.
|
function myfunction($data, $event) // the method to run.
|
||||||
{
|
{
|
||||||
// var_dump($data);
|
// var_dump($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function anotherfunction($data) // the method to run.
|
function anotherfunction($data, $event) // the method to run.
|
||||||
{
|
{
|
||||||
// var_dump($data);
|
// var_dump($data);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user