User tests: Successful: Unsuccessful:
Pull Request for Issue # .
When inheriting the model from within a custom component the inherited model FinderModelSearch when populating its state requires its components parameters. To fetch them it utilises JApplication::getParams(). However, if that model is inherited by a custom components model, which overrides populateState like so
protected function populateState($ordering = null, $direction = null)
{
// Call parent for initial setup.
parent::populateState($ordering, $direction);
...
}
then the context used by JApplication::getParams() is that of the custom component and the parameters returned are not those of com_finder. For that reason JApplication::getParams() must be passed the component name and correctly be JApplication::getParams('com_finder').
FinderModelSearch.populateState as described above.FinderViewSearch and override its display method the same way we override the model's populateState - just call parent::display($tpl) in there. This will call the parent view's display method where the model is called to return some data. That call will trigger the populateState method using the context of the custom component thus returning the wrong parameters.FinderModelSearch::populateState just var_dump() the parameters to see what is returned.$params = $app->getParams().$params = $app->getParams('com_finder') and reload.| Status | New | ⇒ | Pending |
| Labels |
Added:
?
|
||
| Category | ⇒ | Components |
could you provide sample test code please.. like perhaps a 'hello world' component?
I have tested this item
I have tested this item
# Testing steps
I agree with @priiish I don't think, that's expected behavior, that you get com_finder params, when you're in your own extension. I expect "my" params.
If I want exactly the com_finder params, I could add the call in my extended populateState method.
Another side effect of this change would be, that we have to change all other models, too. Because if you extend from any core model class, you'll have the current behavior.
I have to side with @priiish and @bembelimen here.
Closing as expected behavior.
| Status | Pending | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-07-26 09:00:00 |
| Closed_By | ⇒ | infograf768 |
| Category | Components | ⇒ | Front End com_finder Components |
This could really use some tests...