1
0
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:
camer0n
2025-04-02 17:31:12 -07:00
parent ec5a16b3eb
commit b1bd073b84
2 changed files with 36 additions and 17 deletions

View File

@@ -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

View File

@@ -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);
} }