diff options
author | Gervase Markham <gerv@gerv.net> | 2011-01-27 13:55:58 +0100 |
---|---|---|
committer | Gervase Markham <gerv@mozilla.org> | 2011-01-27 13:55:58 +0100 |
commit | e237b7e7583c6e7ab35840050d8bd9ce71ac5a6f (patch) | |
tree | 2332fb520622212b28758a620f5548a3388b89e5 | |
parent | 2a5c9e0c4541e0c995f5b53a26e0a9ae9195c031 (diff) | |
download | bugzilla-e237b7e7583c6e7ab35840050d8bd9ce71ac5a6f.tar.gz bugzilla-e237b7e7583c6e7ab35840050d8bd9ce71ac5a6f.tar.xz |
Allow extensions to alter quicksearch terms and search format. r=mkanat.
https://bugzilla.mozilla.org/show_bug.cgi?id=621878
-rw-r--r-- | Bugzilla/Hook.pm | 15 | ||||
-rw-r--r-- | Bugzilla/Search/Quicksearch.pm | 2 | ||||
-rw-r--r-- | extensions/Example/Extension.pm | 8 |
3 files changed, 25 insertions, 0 deletions
diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index de46f9a25..cf81e9c7d 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -1136,6 +1136,21 @@ Params: =back +=head2 quicksearch_map + +This hook allows you to alter the Quicksearch syntax to include e.g. special +searches for custom fields you have. + +Params: + +=over + +=item C<map> - a hash where the key is the name you want to use in +Quicksearch, and the value is the name from the C<fielddefs> table that you +want it to map to. You can modify existing mappings or add new ones. + +=back + =head2 sanitycheck_check This hook allows for extra sanity checks to be added, for use by diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index b2151ba3a..340421bbb 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -101,6 +101,8 @@ sub FIELD_MAP { status_whiteboard cclist_accessible reporter_accessible)}; + Bugzilla::Hook::process('quicksearch_map', {'map' => \%full_map} ); + $cache->{quicksearch_fields} = \%full_map; return $cache->{quicksearch_fields}; diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm index 14bf6df87..f56416559 100644 --- a/extensions/Example/Extension.pm +++ b/extensions/Example/Extension.pm @@ -649,6 +649,14 @@ sub product_end_of_create { } } +sub quicksearch_map { + my ($self, $args) = @_; + my $map = $args->{'map'}; + + # This demonstrates adding a shorter alias for a long custom field name. + $map->{'impact'} = $map->{'cf_long_field_name_for_impact_field'}; +} + sub sanitycheck_check { my ($self, $args) = @_; |