mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 17:24:18 +02:00
ObjectController: rudimentary sample json support
This commit is contained in:
parent
8b7388cfe3
commit
cd5ce8063a
@ -54,6 +54,12 @@ abstract class ObjectController extends ActionController
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
if ($this->wantsJson()) {
|
||||
header('Content: application/json');
|
||||
echo $this->object->toJson($this->params->shift('resolved'));
|
||||
exit;
|
||||
}
|
||||
|
||||
return $this->editAction();
|
||||
}
|
||||
|
||||
@ -211,4 +217,9 @@ abstract class ObjectController extends ActionController
|
||||
|
||||
return $this->object;
|
||||
}
|
||||
|
||||
protected function wantsJson()
|
||||
{
|
||||
return $this->params->shift('json');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user