Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1081

Joomla! 5.x Coding • Joomla 5, Empty state in View

$
0
0
I have recently upgraded a component I wrote to Joomla 5 successfully and am now trying to eradicate deprecated code, but am running into problems. Specifically, the data that the views get from the model are empty or null.

In my view I have:

Code:

class HtmlView extends BaseHtmlView{public $state;public $items=[];public $pagination;    public $filterForm;    public $activeFilters=[];public function display($tpl = null){$this->state= $this->get('State');$this->items= $this->get('Items');$this->pagination= $this->get('Pagination');        $this->filterForm= $this->get('FilterForm');        $this->activeFilters= $this->get('ActiveFilters');// etc.
I have also implemented populateState in my model:

Code:

protected function populateState($ordering = null, $direction = null){        $app = Factory::getApplication();        $value = $app->input->get('limit', $app->get('list_limit', 0), 'uint');        $this->setState('list.limit', $value);        $value = $app->input->get('limitstart', 0, 'uint');        $this->setState('list.start', $value);$search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');$this->setState('filter.search', $search);$domain_id = $this->getUserStateFromRequest($this->context.'.filter.domain_id', 'filter_domain_id', 0, 'int');$this->setState('filter.domain_id', $domain_id);// etc.$log_msg = str_ireplace( chr(10),' ',str_ireplace( chr(13),' ','In populateState() of Diagnoses admin model, state is: '.print_r($this->getState(), 1) ) );Log::add( $log_msg, Log::INFO, 'com_nandabase' );//error_log($log_msg);        parent::populateState($ordering, $direction);}
Unfortunately, $this->state, $this->items $this->filterForm are all empty and $this->pagination and $this->activeFilters probably are as well. The message I'm logging above does not even appear in the Log file. There is nothing in the PHP error log, just no data. Am I missing something?

Statistics: Posted by kalinma — Wed Sep 04, 2024 2:39 am



Viewing all articles
Browse latest Browse all 1081

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>