-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Should live in the template controller?
/**
* Takes the given parameters and returns a formed JSON string
* @param string $state success/error
* @param mixed $data the data to be returned
* @param string $layout the HTML to be returned
* @param null|array $errors
* @param null|array $extra any additional array pairs to return
* @param string $type
*/
public function response($state, $data, $layout = null, $errors = null, $extra = null, $type = 'json') {
if($type == 'json') {
$json = array(
'state' => $state,
'data' => $data,
'layout' => $layout,
'errors' => $errors
);
if($extra) $json = array_merge($json, $extra);
echo json_encode($json);
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels