I am looking at line 34 of /administrator/components/com_contact/views/contacts/view.html.php where is says $this->items = $this->get('Items'); What I don't understand is how that is actually calling the protected function getListQuery() on line 123 of /administrator/components/com_contact/models/contacts.php
There are also some other things I don't understand how are working... like
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
What are these calling? I looked at the documentation for "get()" but it doesn't say what these are actually calling because I don't see any methods called getPagination, getState or getItems... It appears the get('Items') is somehow magically calling getListQuery().
I'm presuming 1.7/2.5+ here...
In Joomla!'s MVC the view contacts (ContactViewContacts which extends JView) automatically loads the model contacts (or in J! terminology ContactModelContacts) which as a class extends JModelList.
The get() looks in the view to get data from a registered model or a property of the view.
So;
$this->items = $this->get('Items');
is actually a call to the model ContactModelContacts which has a matching getItems() in it's parent.
The model file com_contact/models/contacts.php doesn't implement it's own getItems(), so the getItems() from the JModelList class is used (found in /libraries/joomla/application/component/modellist.php).
This in turn calls getListQuery() - no magic just inheritance.
The $this->get('Pagination') is doing the same thing, ie. accessing the implementation in the models parent.
The $this->get('State') is probably going all the way back to the JModel implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With