No Code Attached Yet bug
avatar georgebara
georgebara
11 Mar 2024

Steps to reproduce the issue

echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filtersHidden' =>false)));
does not show the filters by default.

Expected result

When filtersHidden option is set to false the filter should be shown even if no filter is selected

Actual result

The filters are not shown by default.

System information (as much as possible)

Joomla 5.0.3

Additional comments

\layouts\joomla\searchtools\default.php line 61

'filtersHidden'       => isset($data['options']['filtersHidden']) && $data['options']['filtersHidden'] ? $data['options']['filtersHidden'] : $hideActiveFilters,

filtersHidden is taken into consideration only if it is set to true
filtersHidden is not taken into consideration when displaying the filters. Only $hideActiveFilters is taken into account.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar georgebara georgebara - open - 11 Mar 2024
avatar georgebara georgebara - change - 11 Mar 2024
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 11 Mar 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 11 Mar 2024
avatar georgebara
georgebara - comment - 11 Mar 2024

Proposed solution

// Set some basic options.
$customOptions = [
    'filtersHidden'       => isset($data['options']['filtersHidden'])? $data['options']['filtersHidden'] : $hideActiveFilters,
    'filterButton'        => isset($data['options']['filterButton']) && $data['options']['filterButton'] ? $data['options']['filterButton'] : $showFilterButton,
    'defaultLimit'        => $data['options']['defaultLimit'] ?? Factory::getApplication()->get('list_limit', 20),
    'searchFieldSelector' => '#filter_search',
    'selectorFieldName'   => $selectorFieldName,
    'showSelector'        => $showSelector,
    'orderFieldSelector'  => '#list_fullordering',
    'showNoResults'       => !empty($noResultsText),
    'noResultsText'       => !empty($noResultsText) ? $noResultsText : '',
    'formSelector'        => !empty($data['options']['formSelector']) ? $data['options']['formSelector'] : '#adminForm',
];

// Merge custom options in the options array.
$data['options'] = array_merge($customOptions, $data['options']);

// Add class to hide the active filters if needed.
$filtersActiveClass = $hideActiveFilters && $customOptions['filtersHidden']? '' : ' js-stools-container-filters-visible';

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42999.
avatar Hackwar Hackwar - change - 26 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 26 Mar 2024
avatar ssnobben
ssnobben - comment - 3 Apr 2024

Any update to fix this one? @alikon @Hackwar

avatar ssnobben
ssnobben - comment - 13 Apr 2024

@laoneo this one will not be into J 5.1 ?

avatar Hackwar
Hackwar - comment - 6 Aug 2024

@georgebara thank you for reporting this. Since you already have a proposal, would you be able to create a pull request for this?

avatar Quy Quy - change - 14 Aug 2024
The description was changed
avatar Quy Quy - edited - 14 Aug 2024

Add a Comment

Login with GitHub to post a comment