json_controller

Triggered on execution of every JSON controller in the administrative backend.

Helpdesk

Input (passed by reference)

$params['controller'] waJsonController Controller class instance.
$params['response'] array Controller’s response. Can be modified by a plugin.
$params['errors'] array Controller’s array of errors. Can be modified by a plugin.
… your plugin code …

Output

Helpdesk

Plugin code example

PHP

public function jsonController(&$params)
{
    if (isset($params['response']['requests'])) {
        $requests = &$params['response']['requests'];

        // mark all requests containing the word 'error' in the summary
        array_walk($requests, function(&$request) {
            if (mb_stripos($request['summary'], _wp('error'))) {
                $request['list_row_css'] .= 'font-weight: bold; color: red!important';
            }
        });
    }
}