You are here

README.txt in Autocomplete Deluxe 8

Same filename and directory in other branches
  1. 7.2 README.txt
  2. 7 README.txt
CONTENTS OF THIS FILE
---------------------

* Introduction
* Requirements
* Installation
* Configuration
* FAQ
* Maintainers


INTRODUCTION
------------

The Autocomplete Deluxe module is an enhanced autocomplete element that uses the
JQuery UI autocomplete. It will also implement a widget for taxonomy. This
module does not require any 3rd party jQuery libraries.

 * For a full description of the module visit
   https://www.drupal.org/project/autocomplete_deluxe

 * To submit bug reports and feature suggestions, or to track changes visit
   https://www.drupal.org/project/issues/autocomplete_deluxe


REQUIREMENTS
------------

This module requires no modules outside of Drupal 8.x core.


INSTALLATION
------------

To install the Autocomplete Deluxe module for Drupal 8, run the following
command: composer require drupal/autocomplete_deluxe
For further information, see:
https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies


CONFIGURATION
-------------

To set up a field named Tags which uses an Autocomplete Deluxe widget to set
values for that field from the Tags taxonomy, do the following:

 * Navigate to Administration > Modules and enable the Autocomplete Deluxe
   module.
 * Navigate to Administration  > Structure > Content types and select manage
   fields of the content type you wish to edit.
 * Add a new field of "Term reference" named "Tags". Select the Widget Type
   "Autocomplete Deluxe" in the drop down menu. Save.
 * Select the Tags vocabulary.  Save field settings.
 * Customize or keep the default Autocomplete Deluxe settings for the field.
   Save settings.

Now when new content is added the Tags widget allows editors to enter
existing tags as well as create new ones.


FAQ
---

Q: Can I use the Autocomplete Deluxe widget as a Views exposed filter?

A: Why yes, yes you can!  First, add the field as a traditional exposed
   Autocomplete filter in your view.  Then, create a custom module (see
   https://www.drupal.org/docs/7/creating-custom-modules if you have
   never written a module before), where your .module file contains
   something like the following:

```
   function MY_MODULE_form_alter(&$form, Drupal\Core\Form\FormStateInterface
     $form_state, $form_id) {
     // Variables specific to your View.
     $my_exposed_filter_field = 'field_term_ref';
     $my_target_bundle = 'test_vocab';

     if ($form_id == 'views_exposed_form' &&
       isset($form[$my_exposed_filter_field . '_target_id'])) {
       $selection_settings = array(
         'target_bundles' => array($my_target_bundle => $my_target_bundle),
         'sort' => array('field' => '_none'),
         'auto_create' => (BOOL) 0,
         // Even though we've specified '0' for 'auto_create', it seems that
         // a value for 'auto_crteate_bundle' is required for this to work.
         'auto_create_bundle' => 'tags',
         'match_operator' => 'CONTAINS',
       );
       $target_type = 'taxonomy_term';
       $selection_handler = 'default:taxonomy_term';
       $data = serialize($selection_settings) . $target_type .
         $selection_handler;
       $selection_settings_key = Drupal\Component\Utility\Crypt::hmacBase64(
         $data,
         Drupal\Core\Site\Settings::getHashSalt()
       );
       $route_parameters = [
         'target_type' => $target_type,
         'selection_handler' => $selection_handler,
         'selection_settings_key' => $selection_settings_key,
       ];
       $url = Drupal\core\Url::fromRoute(
         'autocomplete_deluxe.autocomplete',
         $route_parameters,
         ['absolute' => TRUE]
       )->toString();

       $form[$my_exposed_filter_field . '_target_id'] = array(
         '#type' => 'autocomplete_deluxe',
         '#autocomplete_deluxe_path' => $url,
         '#selection_settings' => $selection_settings,
         '#multiple' => TRUE,
         '#target_type' => $target_type,
         '#selection_handler' => $selection_handler,
         '#limit' => 10,
         '#size' => 60,
         '#new_terms' => 0,
         '#min_length' => 0,
         '#delimiter' => ',',
         '#not_found_message_allow' => 0,
         '#not_found_message' => "The term '@term' will be added.",
       );
     }
   }
```


MAINTAINERS
-----------

Current maintainers:

 * Edward Chan (edwardchiapet) - https://www.drupal.org/u/edwardchiapet
 * Lee Nakamura (LNakamura) - https://www.drupal.org/u/lnakamura
 * Mohammed J. Razem - https://www.drupal.org/u/mohammed-j-razem
 * Rajab Natshah - https://www.drupal.org/u/rajabnatshah

Active support and ongoing development by Mediacurrent -
http://www.mediacurrent.com/

Maintenance for D8 and D9 versions by Vardot -
https://www.vardot.com/

For additional information, see the project page on Drupal.org
<https://www.drupal.org/project/autocomplete_deluxe>

File

README.txt
View source
  1. CONTENTS OF THIS FILE
  2. ---------------------
  3. * Introduction
  4. * Requirements
  5. * Installation
  6. * Configuration
  7. * FAQ
  8. * Maintainers
  9. INTRODUCTION
  10. ------------
  11. The Autocomplete Deluxe module is an enhanced autocomplete element that uses the
  12. JQuery UI autocomplete. It will also implement a widget for taxonomy. This
  13. module does not require any 3rd party jQuery libraries.
  14. * For a full description of the module visit
  15. https://www.drupal.org/project/autocomplete_deluxe
  16. * To submit bug reports and feature suggestions, or to track changes visit
  17. https://www.drupal.org/project/issues/autocomplete_deluxe
  18. REQUIREMENTS
  19. ------------
  20. This module requires no modules outside of Drupal 8.x core.
  21. INSTALLATION
  22. ------------
  23. To install the Autocomplete Deluxe module for Drupal 8, run the following
  24. command: composer require drupal/autocomplete_deluxe
  25. For further information, see:
  26. https://www.drupal.org/docs/develop/using-composer/using-composer-to-manage-drupal-site-dependencies
  27. CONFIGURATION
  28. -------------
  29. To set up a field named Tags which uses an Autocomplete Deluxe widget to set
  30. values for that field from the Tags taxonomy, do the following:
  31. * Navigate to Administration > Modules and enable the Autocomplete Deluxe
  32. module.
  33. * Navigate to Administration > Structure > Content types and select manage
  34. fields of the content type you wish to edit.
  35. * Add a new field of "Term reference" named "Tags". Select the Widget Type
  36. "Autocomplete Deluxe" in the drop down menu. Save.
  37. * Select the Tags vocabulary. Save field settings.
  38. * Customize or keep the default Autocomplete Deluxe settings for the field.
  39. Save settings.
  40. Now when new content is added the Tags widget allows editors to enter
  41. existing tags as well as create new ones.
  42. FAQ
  43. ---
  44. Q: Can I use the Autocomplete Deluxe widget as a Views exposed filter?
  45. A: Why yes, yes you can! First, add the field as a traditional exposed
  46. Autocomplete filter in your view. Then, create a custom module (see
  47. https://www.drupal.org/docs/7/creating-custom-modules if you have
  48. never written a module before), where your .module file contains
  49. something like the following:
  50. ```
  51. function MY_MODULE_form_alter(&$form, Drupal\Core\Form\FormStateInterface
  52. $form_state, $form_id) {
  53. // Variables specific to your View.
  54. $my_exposed_filter_field = 'field_term_ref';
  55. $my_target_bundle = 'test_vocab';
  56. if ($form_id == 'views_exposed_form' &&
  57. isset($form[$my_exposed_filter_field . '_target_id'])) {
  58. $selection_settings = array(
  59. 'target_bundles' => array($my_target_bundle => $my_target_bundle),
  60. 'sort' => array('field' => '_none'),
  61. 'auto_create' => (BOOL) 0,
  62. // Even though we've specified '0' for 'auto_create', it seems that
  63. // a value for 'auto_crteate_bundle' is required for this to work.
  64. 'auto_create_bundle' => 'tags',
  65. 'match_operator' => 'CONTAINS',
  66. );
  67. $target_type = 'taxonomy_term';
  68. $selection_handler = 'default:taxonomy_term';
  69. $data = serialize($selection_settings) . $target_type .
  70. $selection_handler;
  71. $selection_settings_key = Drupal\Component\Utility\Crypt::hmacBase64(
  72. $data,
  73. Drupal\Core\Site\Settings::getHashSalt()
  74. );
  75. $route_parameters = [
  76. 'target_type' => $target_type,
  77. 'selection_handler' => $selection_handler,
  78. 'selection_settings_key' => $selection_settings_key,
  79. ];
  80. $url = Drupal\core\Url::fromRoute(
  81. 'autocomplete_deluxe.autocomplete',
  82. $route_parameters,
  83. ['absolute' => TRUE]
  84. )->toString();
  85. $form[$my_exposed_filter_field . '_target_id'] = array(
  86. '#type' => 'autocomplete_deluxe',
  87. '#autocomplete_deluxe_path' => $url,
  88. '#selection_settings' => $selection_settings,
  89. '#multiple' => TRUE,
  90. '#target_type' => $target_type,
  91. '#selection_handler' => $selection_handler,
  92. '#limit' => 10,
  93. '#size' => 60,
  94. '#new_terms' => 0,
  95. '#min_length' => 0,
  96. '#delimiter' => ',',
  97. '#not_found_message_allow' => 0,
  98. '#not_found_message' => "The term '@term' will be added.",
  99. );
  100. }
  101. }
  102. ```
  103. MAINTAINERS
  104. -----------
  105. Current maintainers:
  106. * Edward Chan (edwardchiapet) - https://www.drupal.org/u/edwardchiapet
  107. * Lee Nakamura (LNakamura) - https://www.drupal.org/u/lnakamura
  108. * Mohammed J. Razem - https://www.drupal.org/u/mohammed-j-razem
  109. * Rajab Natshah - https://www.drupal.org/u/rajabnatshah
  110. Active support and ongoing development by Mediacurrent -
  111. http://www.mediacurrent.com/
  112. Maintenance for D8 and D9 versions by Vardot -
  113. https://www.vardot.com/
  114. For additional information, see the project page on Drupal.org