Problem/Motivation

Many JS Search Inputs in D8 now. They all implemented different search method. It not possible / easy to alter it. For example, if I want to add regex search, I have to patch all modules one-by-one with monkey-like patching.

Here're two examples in CORE:

View UI:

      this.options.forEach(function (option) {
        function hasWord(word) {
          return option.searchText.indexOf(word) !== -1;
        }

Module Page:

      function filterModuleList(e) {
        var query = $(e.target).val();
        // Case insensitive expression to find query at the beginning of a word.
        var re = new RegExp('\\b' + query, 'i');

        function showModuleRow(index, row) {
          var $row = $(row);
          var $sources = $row.find('.table-filter-text-source, .module-name, .module-description');
          var textMatch = $sources.text().search(re) !== -1;
          $row.closest('tr').toggle(textMatch);
        }

Proposed resolution

- Option A: Public Method for each module
- Option B: Centered API

Remaining tasks

- Discussion
- Patch

User interface changes

- N/A

API changes

- TBA

Data model changes

- TBA

Comments

droplet created an issue. See original summary.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.