On Thursday, March 29, 2012 4:51:30 AM UTC-4, Eric Fernance wrote:
I just went through the same issue to specify a task, drop the fieldset name="request" - a fieldset tells Joomla! to display a settings tab. Just drop it, ie:
<fields name="request">
<field
name="controller"
type="hidden"
value="entitlements">
</field>
</fields>
I believe that I had to surround it with either <site> or <config> in order to make it work. I'll give my code a check when I can get my pc back from the kids.
Also note, see the content component for how the controller is currently being specified. It seems that the task parameter is used to refer to a controller, while the view component is used to refer method to be called....though looking through it I see a lot of comments such as:
// TODO This is a bandaid, not a long term solution.
// if ($layout) {
// $append .= '&layout='.$layout;
// }
So it seems that the precise definition/usage for task/view/layout/tmpl is currently in flux.
Also note, if you use JController's display method, which I find more convenient then adding 60% of that code into my own custom display method, there are a few assumptions JController makes which can cause problems. No matter what you set the default model to before calling it, the base class goes and overrides the default based on the task parameter. In the end, I gave up trying to make Joomla! use the default model I wanted since it kept going overwritten by other platform methods - and instead I just pulled my models manually.
IE instead of calling in the controller:
$model = $this->getModel('event');
$view = $this->getView();
$view->setModel($model,true);
And then later on in the view calling $model = $this->getModel();
I ended up doing:
$model = $this->getModel('event');
$view = $this->getView();
// setting default = true is useless, but I do it anyway because one day it should work
$view->setModel($model,true);
And then later on in the view calling
$layout = $this->getLayout();
$model = $this->getModel($layout);
It's not the end of the world, it's just not the way all the tutorials say to set do it. In the end, it just re-enforces my dislike for counting on the 'default' behavior in an api and only specifying alternate behaviour - you just can't depend on the default behaviour to always be the default.