Closed nikosdion closed 7 years ago
Closes gh-601 This is essentially the same feature but we'll be instead making this behaviour the default
We cannot use Joomla's core code. Joomla's Search Tools are very shoddily implemented.
First of all, they require to have a JForm descendant filterForm property in your view object. This is not a huge obstacle but it makes it very inflexible: rendering the search fields in a Search Tools area requires creating a form on the fly and using wrapper field types. It also makes it really hard for developers to implement their own Search Tool filters in classic PHP or Blade views: any kind of search tool field is not provided as a JFormField requires the developer to write their own field class...
Moreover, it assumes that it MUST render the sort by and pagination fields. Unfortunately it doesn't include the sort order, rendering it moderately useless.
However, the show-stopper is the condition under which the Search Tools button itself is shown. A sane person would think that the trigger would be the existence of one or more fields in the filter form. Nope. The condition is the existence of a field with name="search". This means that unless you override your DataModel to map "search" to another field for search purposes your form is broken.
All those unfortunate assumptions are deeply ingrained in the JLayout templates for displaying the search tools. Therefore we can't use Joomla's Search Tools implementation just like we can't use any other JLayout: all of the assumptions are bad and make no sense unless you are talking about the core components only.
The only thing I've not tried yet is using some dark magic to trick JForm into rendering arbitrary, custom HTML...
Right now XML form filters are rendered as sidebar filters.
Since Joomla! 3.3 we have Search Tools, i.e. a DIV with filters which is invisible unless filters are set (it opens automatically) or the user clicks the Search Filters button. Since Joomla! 3.5 this is the default way core components work.
FOF 3.1 will default to this new method of rendering filters. A fallback to the old way (sidebar filters) will be available with a fork of the Joomla 3 renderer class.