I am using the searchtools filters in the front end of a custom component.
So I am displaying the fields in my template :
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
Everything works fine but in the mobile and tablet the searchtools shows only the search field and hides everything else. I do not want this. Is a custom component so I want to display all the filters even in mobile in a element that I control his visibility.
So I decided to render the fields the way I like in my tmpl/default.php file. The problem is that no field is rendering.
Here is the code : In the view :
$this->filterForm = $this->get('FilterForm');
JLog::add('filterform: ' . print_r($this->filterForm, TRUE), JLog::DEBUG, 'com_contract-site-ContractView');
And the log
DEBUG 127.0.0.1 com_contract-site-contractview filterform: Joomla\CMS\Form\Form Object
(
[data:protected] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
[list] => stdClass Object
(
[limit] => 20
)
)
[initialized:protected] =>
[separator] => .
)
[xml:protected] => SimpleXMLElement Object
(
[fields] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => filter
)
[field] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => search
[type] => text
[label] => COM_CONTRACT_CONTRACTS_SEARCH_IN_TITLE
[hint] => JSEARCH_FILTER
[class] => js-stools-search-string
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => published
[type] => status
[label] => JOPTION_SELECT_PUBLISHED
[description] => JOPTION_SELECT_PUBLISHED_DESC
[onchange] => this.form.submit();
)
[option] => JOPTION_SELECT_PUBLISHED
)
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => list
)
[field] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => limit
[type] => limitbox
[class] => input-mini
[default] => 25
[label] => COM_CONTENT_LIST_LIMIT
[description] => COM_CONTRACT_LIST_LIMIT_DESC
[onchange] => this.form.submit();
)
)
)
)
)
[repeat] =>
)
So I got all the fields, but no field is rendered.
tmpl/default.php
<?php echo $this->filterForm->renderField('search'); ?>
<?php echo $this->filterForm->renderField('published'); ?>
<?php echo $this->filterForm->renderField('clientlist'); ?>
etc ...
Thank you