? Success

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
13 Oct 2014

Fun Fact

The searchtools JLayout allows to pass some options into it. But the options need to be of different values to stick. If two are passed of same value then only the first one sticks and the second gets deleted.

Issue

The JLayout uses array_unique() after it merged some default options with the passed options. I have no clue what the author wanted to achieve, but it's certainly wrong. array_unqiue will make sure that the values of the array are unique.

Solution

Removing array_unique()

Testing

Edit the call to the JLayout and pass some additional options to it.
Example:
In https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/views/articles/tmpl/default.php#L65 change echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); to echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => false, 'searchButton' => false)));
Supported options would be

  • filterButton
  • searchButton
  • filtersHidden
  • defaultLimit
  • searchFieldSelector
  • orderFieldSelector The first three are good candidates to play with as they all expect boolean parameter.

Either check by testing if the output reflects the parameters or dump the $data['options'] in the JLayout file (/layouts/joomla/searchtools/default.php).

avatar Bakual Bakual - open - 13 Oct 2014
avatar jissues-bot jissues-bot - change - 13 Oct 2014
Labels Added: ?
avatar phproberto
phproberto - comment - 14 Oct 2014

@test +1

I have no clue what the author wanted to achieve, but it's certainly wrong. array_unqiue will make sure that the values of the array are unique.

It was me :D

Search tools is based on things developed for my own extensions. It seems that I used an old layout or modified it badly when contributing it.

Thanks for the fix :+1:

avatar joomdonation
joomdonation - comment - 14 Oct 2014

@test: OK from me.

PS: When I tested this pull request, I realized that "filterButton" is depended on "searchButton". Filter button section in search tools will only be displayed if we pass true to the value of both "filterButton" and "searchButton" parameters. If we set "filterButton" => true and "searchButton" => false, the filter button section in search tool is not displayed. Is it an expected behavior ?

avatar phproberto
phproberto - comment - 14 Oct 2014

PS: When I tested this pull request, I realized that "filterButton" is depended on "searchButton". Filter button section in search tools will only be displayed if we pass true to the value of both "filterButton" and "searchButton" parameters. If we set "filterButton" => true and "searchButton" => false, the filter button section in search tool is not displayed. Is it an expected behavior ?

This is the behavior we have in our layout but the jQuery plugin is independent. So extension developers can display it where they want and how they want.

avatar joomdonation
joomdonation - comment - 14 Oct 2014

OK @phproberto. Thanks for confirming.

avatar infograf768
infograf768 - comment - 14 Oct 2014

2 good tests. Merging. Thanks.

avatar infograf768 infograf768 - close - 14 Oct 2014
avatar infograf768 infograf768 - change - 14 Oct 2014
The description was changed
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-10-14 06:29:44

Add a Comment

Login with GitHub to post a comment