You are here

README.txt in Facet API Bonus 7


INSTALLATION


Simply save this module's subdir in your contrib module directory,
and enable the module.


USAGE


Within the Facet API UI of a specific facet, go to "Dependency" or "Filters" to
add one of this module's plugins. The usage of the specific plugins are well
explained within their settings forms.


MODULE DESCRIPTION


Facet API Bonus for Drupal 7 is a collection of additional Facet API plugins and
functionality, foremost filter and dependency plugins – And a place to collect
more additional Facet API extensions.

Currently Facet API Bonus includes:

* Facet Dependency

  Dependency plugin to make one facet (say "product category")
  to show up depending on other facets or specific facet items being active
  (say "content type" is "product" or "service"). Very flexible,
   supports multiple facets to be dependencies, as well as regexp for specifying
   facet item dependencies, as well as option how to behave if a dependency is
   being lost.

* Filter "Exclude Items"

  Filter plugin to exclude certain facet items by their
  markup/title or internal value (say excluding "page" from "content types").
  Regexp are also possible.

* Filter "Rewrite Items"

  Filter plugin to rewrite labels or other data of the facet items by
  implementing a new dedicated hook_facet_items_alter (in a structured array,
  before rendering). Very handy to rewrite list field values or totally custom
  encoded facet values for user friendly output.

  By enabling this filter, items of this facet can be
  rewritten prior to rendering by implementing the hook:

    function HOOK_facet_items_alter(&$build, &$settings) {
      if ($settings->facet == "YOUR_FACET_NAME") {
        foreach($build as $key => $item) {
          $build[$key]["#markup"] = drupal_strtoupper($item["#markup"]);
        }
      }
    }

  (This example simply rewrites all facet items output to be uppercase.)

  Replace "HOOK" with the name of a custom module containing
  your hook implementation, and "YOUR_FACET_NAME" with the
  machine name of the specific facet whose items you want to
  rewrite.

  $build is an array of facet items you
  can rewrite, $settings contains the facet filter settings
  as context to determine the facet and search context.

* Filter "Do not display items that do not narrow results"

  This filter checks the number of items that will be displayed after activating
  facet link and removes the link if the number is the same as currently
  displayed. If link has children in hierarchical structure, it won't be removed.

* Filter "Do not show facet with only X items"

  This filter checks total number of links and if number is less than X, we
  remove all items and hide block completely. Block will not be hidden if there
  any active items in it.

* Filter "Show only deepest level items"

  Removes all items that have children.


* Integration with Page Title module

  Now you can set search (views) page titles using Page Title module. Module
  provides possibility to set tokens 'facetapi_results' and 'facetapi_active'
  groups. So in title we can display number of results on the page or values of
  active facets. As there can be multiple active facet values please use following
  pattern to use facetapi_active tokens:

  list<[facetapi_active:facet-label]: [facetapi_active:active-value]>

  This will make coma separated list of active facet labels and their values.


* Current search block Reset Filters link

  Gives possibility to add link to current block that resets all applied facets.
  Text is customizable.

===> Further additions are very welcome! <===

Facet API Bonus is written for Drupal 7, and is stable, tested,
and ready to be used in production environments.

Requirements:

* Facet API is obviously required, as well as
  a compatible search module (e.g. apachesolr, search_api).

Similar projects:

* http://drupal.org/project/facetapi_extra Module has been deprecated in favour
  of facetapi_bonus module. All features have been merged.


MODULE URL


More information and issues, see the module page, currently at:

  http://drupal.org/project/facetapi_bonus

File

README.txt
View source
  1. INSTALLATION
  2. Simply save this module's subdir in your contrib module directory,
  3. and enable the module.
  4. USAGE
  5. Within the Facet API UI of a specific facet, go to "Dependency" or "Filters" to
  6. add one of this module's plugins. The usage of the specific plugins are well
  7. explained within their settings forms.
  8. MODULE DESCRIPTION
  9. Facet API Bonus for Drupal 7 is a collection of additional Facet API plugins and
  10. functionality, foremost filter and dependency plugins – And a place to collect
  11. more additional Facet API extensions.
  12. Currently Facet API Bonus includes:
  13. * Facet Dependency
  14. Dependency plugin to make one facet (say "product category")
  15. to show up depending on other facets or specific facet items being active
  16. (say "content type" is "product" or "service"). Very flexible,
  17. supports multiple facets to be dependencies, as well as regexp for specifying
  18. facet item dependencies, as well as option how to behave if a dependency is
  19. being lost.
  20. * Filter "Exclude Items"
  21. Filter plugin to exclude certain facet items by their
  22. markup/title or internal value (say excluding "page" from "content types").
  23. Regexp are also possible.
  24. * Filter "Rewrite Items"
  25. Filter plugin to rewrite labels or other data of the facet items by
  26. implementing a new dedicated hook_facet_items_alter (in a structured array,
  27. before rendering). Very handy to rewrite list field values or totally custom
  28. encoded facet values for user friendly output.
  29. By enabling this filter, items of this facet can be
  30. rewritten prior to rendering by implementing the hook:
  31. function HOOK_facet_items_alter(&$build, &$settings) {
  32. if ($settings->facet == "YOUR_FACET_NAME") {
  33. foreach($build as $key => $item) {
  34. $build[$key]["#markup"] = drupal_strtoupper($item["#markup"]);
  35. }
  36. }
  37. }
  38. (This example simply rewrites all facet items output to be uppercase.)
  39. Replace "HOOK" with the name of a custom module containing
  40. your hook implementation, and "YOUR_FACET_NAME" with the
  41. machine name of the specific facet whose items you want to
  42. rewrite.
  43. $build is an array of facet items you
  44. can rewrite, $settings contains the facet filter settings
  45. as context to determine the facet and search context.
  46. * Filter "Do not display items that do not narrow results"
  47. This filter checks the number of items that will be displayed after activating
  48. facet link and removes the link if the number is the same as currently
  49. displayed. If link has children in hierarchical structure, it won't be removed.
  50. * Filter "Do not show facet with only X items"
  51. This filter checks total number of links and if number is less than X, we
  52. remove all items and hide block completely. Block will not be hidden if there
  53. any active items in it.
  54. * Filter "Show only deepest level items"
  55. Removes all items that have children.
  56. * Integration with Page Title module
  57. Now you can set search (views) page titles using Page Title module. Module
  58. provides possibility to set tokens 'facetapi_results' and 'facetapi_active'
  59. groups. So in title we can display number of results on the page or values of
  60. active facets. As there can be multiple active facet values please use following
  61. pattern to use facetapi_active tokens:
  62. list<[facetapi_active:facet-label]: [facetapi_active:active-value]>
  63. This will make coma separated list of active facet labels and their values.
  64. * Current search block Reset Filters link
  65. Gives possibility to add link to current block that resets all applied facets.
  66. Text is customizable.
  67. ===> Further additions are very welcome! <===
  68. Facet API Bonus is written for Drupal 7, and is stable, tested,
  69. and ready to be used in production environments.
  70. Requirements:
  71. * Facet API is obviously required, as well as
  72. a compatible search module (e.g. apachesolr, search_api).
  73. Similar projects:
  74. * http://drupal.org/project/facetapi_extra Module has been deprecated in favour
  75. of facetapi_bonus module. All features have been merged.
  76. MODULE URL
  77. More information and issues, see the module page, currently at:
  78. http://drupal.org/project/facetapi_bonus