1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-22 14:13:03 +02:00

Provide useful debug information to developers wishing to create custom Filter and Batch handling methods.

Media-Manager updated to use the custom batch Handler method.
This commit is contained in:
Cameron
2018-08-07 17:05:08 -07:00
parent 0cce36f3c3
commit 5dc790cd22
2 changed files with 56 additions and 11 deletions

View File

@@ -3471,7 +3471,8 @@ class e_admin_controller_ui extends e_admin_controller
//something like handleListUrlTypeBatch(); for custom handling of 'url_type' field name
$method = 'handle'.$actionName.$this->getRequest()->camelize($field).'Batch';
e107::getDebug()->log("Checking for batch method: ".$method);
e107::getMessage()->addDebug("Searching for custom batch method: ".$method."(".$selected.",".$value.")");
if(method_exists($this, $method)) // callback handling
{
$this->$method($selected, $value);
@@ -3506,7 +3507,7 @@ class e_admin_controller_ui extends e_admin_controller
{
return array();
}
$filter = $tp->toDB(explode('__', $filter_value));
$filter = (array) $tp->toDB(explode('__', $filter_value));
$res = array();
switch($filter[0])
{
@@ -3542,12 +3543,17 @@ class e_admin_controller_ui extends e_admin_controller
default:
//something like handleListUrlTypeFilter(); for custom handling of 'url_type' field name filters
$method = 'handle'.$this->getRequest()->getActionName().$this->getRequest()->camelize($filter[0]).'Filter';
$args = array_slice($filter, 1);
e107::getMessage()->addDebug("Searching for custom filter method: ".$method."(".implode(', ', $args).")");
if(method_exists($this, $method)) // callback handling
{
//return $this->$method($filter[1], $selected); selected?
// better approach - pass all values as method arguments
// NOTE - callbacks are allowed to return QUERY as a string, it'll be added in the WHERE clause
$args = array_slice($filter, 1);
e107::getMessage()->addDebug('Executing filter callback <strong>'.get_class($this).'::'.$method.'('.implode(', ', $args).')</strong>');
return call_user_func_array(array($this, $method), $args);