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()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
|
if ($this->wantsJson()) {
|
||||||
|
header('Content: application/json');
|
||||||
|
echo $this->object->toJson($this->params->shift('resolved'));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->editAction();
|
return $this->editAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,4 +217,9 @@ abstract class ObjectController extends ActionController
|
||||||
|
|
||||||
return $this->object;
|
return $this->object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function wantsJson()
|
||||||
|
{
|
||||||
|
return $this->params->shift('json');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue