You are here

README.txt in Views Filter Harmonizer 7

Same filename and directory in other branches
  1. 8 README.txt
  2. 1.0.x README.txt
VIEWS FILTER HARMONIZER
=======================
This module solves an operational foible with the Views module regarding
filtering. It allows you to have a contextual filter argument apply only when
there is no regular (exposed) filter value present. For intuitive visual
feedback of the underlying process, the module will also fill out the exposed 
filter form with the contextual filter value(s) used.
Once the visitor changes the value for the exposed filter, the module makes sure
that the corresponding contextual filter does not interfere.
This module works for all Views displays (page, attachment etc.) with AJAX on
as well as off.

INSTALLATION
------------
Install and enable like any module.

If you do not wish to see any debug info, visit admin/people/permissions and
untick the boxes under Views Filter Harmonizer, option View info/debug messages.

The only addition you'll see in the Views UI is an extra check box for each
contextual filter field that has a companion exposed filter. It is called
"Ignore this contextual filter after initial page load, when the user applies
this same field's exposed filter." It lives under the heading "WHEN THE FILTER
VALUE IS IN THE URL OR A DEFAULT IS PROVIDED" on the contextual filter config
popup. You get to this popup via the "Advanced" fieldset, located in the upper
right corner of the main Views UI page.
For convenience the same check box is repeated on the Views regular filter
configuration popup form, if a companion contextual filter was configured first.

You can globally enable the above behaviour for ALL fields that have both
contextual and a regular (exposed) filters, via the check box on the
Administration >> Configuration >> Content Authoring >> Views Filter Harmonizer
page. When you do this the checkboxes on the Views UI regular and contextual
filter forms will no longer appear.

USE
---
As mentioned above, the contextual filters kick in upon visiting a "new" page.
What is considered a "new" page?
If your view is located at yoursite.com/worldcup with an optional contextual
country filter/argument, then starting from yoursite.com/worldcup any page OTHER
than yoursite.com/worldcup with or without any optional query string, i.e.
yoursite.com/worldcup?bla=bluh, is a NEW page.
So yoursite.com/worldcup/germany is a new page and the contextual filter
"germany" will be honoured, provided the default exposed filter value is empty.
Staying on this URL, but changing any exposed filter widget, possibly resulting
in a query string being appended, is NOT considered a "new" page. In other
words, the module will ignore the contextual filter "germany" and obey the
exposed filter selection instead.

SPECIAL BEHAVIOUR: MULTI-VALUED EXPOSED FILTERS
-----------------------------------------------
Exposed filters, grouped or single, that have the "Allow multiple selections"
box ticked will have their default values MERGED with the contextual filter
argument(s) upon initial page load.
After initial page load the exposed filter selection will be applied, as per
normal.
Note: on Views that use a pager as well as a multi-valued exposed filter,
harmonization, i.e. the merging of contextual and exposed filter values, will
occur on every page of the pager.

SPACES IN CONTEXTUAL FILTER ARGUMENTS
-------------------------------------
If you tick "Allow multiple values" on the contextual filter configuration panel
you must NOT tick "Transform dashes to spaces". Then append your contextual
arguments to the base URL with spaces replaced by dashes. Alternatively for
view pages with harmonization turned on, you may use the | (pipe symbol) to
OR contextual filter arguments. This will allow multiple contextual values,
with or without spaces, without you having to tick the "Allow multiple values"
box.

KEEP IN MIND
------------
For a Grouped filter with "Allow multiple selections" ticked the user selections
are ANDed together by default. If you use an accompanying contextual filter and
intend to string together multiple values via plus signs in the URL, then you
may want to pair that up in your exposed filter with a likewise OR.
To do this, click under Filter Criteria the down-arrow next to "Add", followed
by "Add/Or, Rearrange". Then select the OR operator on the next panel and Apply.

BLOCKS
------
Note that Views that are displayed in blocks will not receive any contextual
arguments appended to the URL, unless you provide a default value, i.e.
through a PHP code snippet like:

  return arg(1);

This extracts the first contextual argument, assuming the View path has only one
component.
With this in place you can then use the "ignore" check box just as you do for
page and attachment displays.
Remember: for exposed filters to appear with Views block displays, AJAX must be
ON.

CACHING ENGINES
---------------
By default the module uses the $_SESSION variable to store the previously
visited path (including contextual filter arguments). If you use a caching
engine or web accelerator like Varnish, this may be undesirable. In that case
install http://drupal.org/project/session_cache so that this info is
transparently stored on an alternative medium, e.g. a cookie (with page
exclusion strategy) or the database (using a suitable session id). See the
Session Cache API documentation for details.

GEOFIELD
--------
For Views Filter Harmonizer to work with the Geofield module, the Geofield
Exposed Proximity Filter needs to have its Source of Origin Point set to
"Geocoded Location", not "Contextual Geofield Proximity Filter".
At the same time to display distances the Geofield Proximity Field needs to
have its Source or Origin Point set to "Exposed Geofield Proximity Filter", so
that the distances displayed reflect the filter origin entered.

                                    * * *

File

README.txt
View source
  1. VIEWS FILTER HARMONIZER
  2. =======================
  3. This module solves an operational foible with the Views module regarding
  4. filtering. It allows you to have a contextual filter argument apply only when
  5. there is no regular (exposed) filter value present. For intuitive visual
  6. feedback of the underlying process, the module will also fill out the exposed
  7. filter form with the contextual filter value(s) used.
  8. Once the visitor changes the value for the exposed filter, the module makes sure
  9. that the corresponding contextual filter does not interfere.
  10. This module works for all Views displays (page, attachment etc.) with AJAX on
  11. as well as off.
  12. INSTALLATION
  13. ------------
  14. Install and enable like any module.
  15. If you do not wish to see any debug info, visit admin/people/permissions and
  16. untick the boxes under Views Filter Harmonizer, option View info/debug messages.
  17. The only addition you'll see in the Views UI is an extra check box for each
  18. contextual filter field that has a companion exposed filter. It is called
  19. "Ignore this contextual filter after initial page load, when the user applies
  20. this same field's exposed filter." It lives under the heading "WHEN THE FILTER
  21. VALUE IS IN THE URL OR A DEFAULT IS PROVIDED" on the contextual filter config
  22. popup. You get to this popup via the "Advanced" fieldset, located in the upper
  23. right corner of the main Views UI page.
  24. For convenience the same check box is repeated on the Views regular filter
  25. configuration popup form, if a companion contextual filter was configured first.
  26. You can globally enable the above behaviour for ALL fields that have both
  27. contextual and a regular (exposed) filters, via the check box on the
  28. Administration >> Configuration >> Content Authoring >> Views Filter Harmonizer
  29. page. When you do this the checkboxes on the Views UI regular and contextual
  30. filter forms will no longer appear.
  31. USE
  32. ---
  33. As mentioned above, the contextual filters kick in upon visiting a "new" page.
  34. What is considered a "new" page?
  35. If your view is located at yoursite.com/worldcup with an optional contextual
  36. country filter/argument, then starting from yoursite.com/worldcup any page OTHER
  37. than yoursite.com/worldcup with or without any optional query string, i.e.
  38. yoursite.com/worldcup?bla=bluh, is a NEW page.
  39. So yoursite.com/worldcup/germany is a new page and the contextual filter
  40. "germany" will be honoured, provided the default exposed filter value is empty.
  41. Staying on this URL, but changing any exposed filter widget, possibly resulting
  42. in a query string being appended, is NOT considered a "new" page. In other
  43. words, the module will ignore the contextual filter "germany" and obey the
  44. exposed filter selection instead.
  45. SPECIAL BEHAVIOUR: MULTI-VALUED EXPOSED FILTERS
  46. -----------------------------------------------
  47. Exposed filters, grouped or single, that have the "Allow multiple selections"
  48. box ticked will have their default values MERGED with the contextual filter
  49. argument(s) upon initial page load.
  50. After initial page load the exposed filter selection will be applied, as per
  51. normal.
  52. Note: on Views that use a pager as well as a multi-valued exposed filter,
  53. harmonization, i.e. the merging of contextual and exposed filter values, will
  54. occur on every page of the pager.
  55. SPACES IN CONTEXTUAL FILTER ARGUMENTS
  56. -------------------------------------
  57. If you tick "Allow multiple values" on the contextual filter configuration panel
  58. you must NOT tick "Transform dashes to spaces". Then append your contextual
  59. arguments to the base URL with spaces replaced by dashes. Alternatively for
  60. view pages with harmonization turned on, you may use the | (pipe symbol) to
  61. OR contextual filter arguments. This will allow multiple contextual values,
  62. with or without spaces, without you having to tick the "Allow multiple values"
  63. box.
  64. KEEP IN MIND
  65. ------------
  66. For a Grouped filter with "Allow multiple selections" ticked the user selections
  67. are ANDed together by default. If you use an accompanying contextual filter and
  68. intend to string together multiple values via plus signs in the URL, then you
  69. may want to pair that up in your exposed filter with a likewise OR.
  70. To do this, click under Filter Criteria the down-arrow next to "Add", followed
  71. by "Add/Or, Rearrange". Then select the OR operator on the next panel and Apply.
  72. BLOCKS
  73. ------
  74. Note that Views that are displayed in blocks will not receive any contextual
  75. arguments appended to the URL, unless you provide a default value, i.e.
  76. through a PHP code snippet like:
  77. return arg(1);
  78. This extracts the first contextual argument, assuming the View path has only one
  79. component.
  80. With this in place you can then use the "ignore" check box just as you do for
  81. page and attachment displays.
  82. Remember: for exposed filters to appear with Views block displays, AJAX must be
  83. ON.
  84. CACHING ENGINES
  85. ---------------
  86. By default the module uses the $_SESSION variable to store the previously
  87. visited path (including contextual filter arguments). If you use a caching
  88. engine or web accelerator like Varnish, this may be undesirable. In that case
  89. install http://drupal.org/project/session_cache so that this info is
  90. transparently stored on an alternative medium, e.g. a cookie (with page
  91. exclusion strategy) or the database (using a suitable session id). See the
  92. Session Cache API documentation for details.
  93. GEOFIELD
  94. --------
  95. For Views Filter Harmonizer to work with the Geofield module, the Geofield
  96. Exposed Proximity Filter needs to have its Source of Origin Point set to
  97. "Geocoded Location", not "Contextual Geofield Proximity Filter".
  98. At the same time to display distances the Geofield Proximity Field needs to
  99. have its Source or Origin Point set to "Exposed Geofield Proximity Filter", so
  100. that the distances displayed reflect the filter origin entered.
  101. * * *