API page: http://api.drupal.org/api/drupal/core--modules--search--search.api.php/f...

The documentation page describe twice what the purpose of hook_seach_page() is:

You can also alter the display of your module's search results by implementing hook_search_page().

You can use hook_search_access() to limit access to searching, and hook_search_page() to override how search results are displayed.

The first sentence should probably be removed.

Comments

jhodgdon’s picture

Issue tags: +Novice

Sounds like a good idea -- just needs a patch. Probably a good Novice project.

avpaderno’s picture

Status: Active » Needs review
StatusFileSize
new1.13 KB
jhodgdon’s picture

Status: Needs review » Needs work

This is not your fault (in the original documentation), but I just noticed one error in this documentation:

+ * hook_search_admin() to add them to the search settings page. You can use
+ * hook_form_FORM_ID_alter(), with FORM_ID set to 'search', to add fields to the
+ * search form (see node_form_search_form_alter() for an example). You can use

FORM_ID needs to be set to 'search_form', not 'search', in that second line.

Other than that, looks good - thanks!

avpaderno’s picture

I noticed that right two hours ago, as I was trying to understand how to override the search results returned from a module implementing hook_search_info(), and noticed that the Node module implements node_form_search_form_alter(), not node_form_search_alter().

I will provide a patch in the next 10 minutes.

avpaderno’s picture

Status: Needs work » Needs review
StatusFileSize
new1.3 KB
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

That looks good, thanks! If we're lucky, it will apply to D7 too.

avpaderno’s picture

Well, if it does, the reference to the files being patched needs to be edited. Drupal 7 modules are not inside the "core" directory. :-)

jhodgdon’s picture

True, but webchick knows how to use -p2 to apply d8 patches to d7 without editing the patch. :) (You already have to use -p1 to ignore the a/ and b/ in the file names. -p2 will ignore the a/core and b/core prefixes, hence making it apply to d7 if the files are still the same.)

catch’s picture

Version: 8.x-dev » 7.x-dev

Committed/pushed to 8.x. I have been requesting re-rolls even if I think the patch would probably apply with p2, but let's test jhodgdon's theory ;)

avpaderno’s picture

I created the patch for Drupal 7, and both the patch are the same, apart the reference to the files being changed; both the patches are applied at the same offset.

avpaderno’s picture

StatusFileSize
new1.28 KB

This is the patch for Drupal 7.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

For future reference, I am actually fine with patch -p2, at least for docs patches that have no chance of breaking tests. For other ones, generally a fresh patch is best just to be safe. With that said, thanks for the re-roll, which makes it easy. :)

Committed and pushed to 7.x.

Automatically closed -- issue fixed for 2 weeks with no activity.