User tests: Successful: Unsuccessful:
Pull Request for Issue #10416.
Use getState instead of direct property read in JModelList to avoid any undefined property warnings.
Using $this->getState against $this->state->get ensures the model state is populated appropriately.
ContentViewArticles at administrator/components/com_content/views/articles/view.html.php in the display method call $this->get('FilterForm'); before $this->get('State') or $this->get('Items') etc.Expected: Everything should work correctly.
Actual: You see 4 php notices such as Notice: Undefined property: JObject::$list....
Fixes #10416
| Status | New | ⇒ | Pending |
| Labels |
Added:
?
|
||
| Category | ⇒ | Libraries |
@andrepereiradasilva yeah, I'm looking at that. Apparently that is the issue with the test definition. But can't say it yet.
| Labels |
Added:
?
|
||
@Devportobello you have to mark as tested in the issue tracker (https://issues.joomla.org/tracker/joomla-cms/10435 login with github and mark test as success).
I have tested this item
successfully on 45a6d09
The notices dissapear after this PR so i will make as success.
I think if you used $this->state->get('list.xxxx') you would get the same result.
But for what is worth, if you exchange the order the filters/ordering/search (aka searchtols) will not work properly. With or without this PR.
I have tested this item
successfully on 45a6d09
| Status | Pending | ⇒ | Ready to Commit |
| Labels | |||
| Labels |
Added:
?
|
||
| Milestone |
Added: |
||
But for what is worth, if you exchange the order the filters/ordering/search (aka searchtols) will not work properly. With or without this PR.
@andrepereiradasilva Can you please explain this.
Note this happens with or without your PR.
For instance, change the order of the $this->get('FilterForm') in the articles view.html.php file.
$this->filterForm = $this->get('FilterForm'); // PUT THIS ONE ON TOP
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->authors = $this->get('Authors');
$this->activeFilters = $this->get('ActiveFilters');Now try to use the searchtools in articles view. search for something, order or filter by something.
You will notice the table will be modified accordly but the searchtools filters pre selected values won't.
@andrepereiradasilva The solution is straightforward. Use $this->get('State') in the view before you call any method on the model.
OR
Change the JModelList::loadFormData() to call $this->getState(); before calling $app->getUserSate()
But that is not all. Therefore instead of a placing a PR, I'd prefer a little discussion regarding loadFormData behavior in JModelList vs JModelForm, preferably on a separate thread.
ok then create a issue / RFC
| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-05-16 21:58:30 |
| Closed_By | ⇒ | roland-d |
Thanks everybody
| Labels |
Removed:
?
|
||
@izharaazmi you have unit test errors.