Skip to content

Specify document type for API #38003

Answered by MarkRS-UK
MarkRS-UK asked this question in Q&A
Discussion options

You must be logged in to vote

Well, I have a solution.

I'm simply loading my custom document into my app object and then setting it in the view in my controller.

		$this->app->loadDocument(new MycustomDocument());
		$view->document = $this->app->getDocument();

I've subclassed ApiController for this.

This was prompted by the need to push json stored in my component table out through the API. I'd hoped to try to use a similarly custom resource object, but can't find a way to inject it into the existing document setup and of course the current api document can't be prevented from trying to json encode my already encoded string.

Is there a more Joomla-ish way to do this?

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MarkRS-UK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant