Just noticed that we don't document hook_search_api_tracker_info_alter() yet, nor is it tested in HooksTest. Same for hook_search_api_displays_alter(). (The other four plugin types seem to be documented and tested correctly.)

Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

Issue tags: +Release blocker, +Novice
sneha_surve’s picture

Assigned: Unassigned » sneha_surve
sinn’s picture

Assigned: sneha_surve » Unassigned
Status: Active » Needs review
StatusFileSize
new4.32 KB

Added tests and information for hook_search_api_tracker_info_alter() and hook_search_api_displays_alter().

Actually hook_search_api_displays_alter() wasn't invoked. Fixed it in Drupal\search_api\Display\DisplayPluginManager.

borisson_’s picture

Status: Needs review » Needs work
+++ b/search_api.api.php
@@ -321,5 +321,42 @@ function hook_search_api_index_reindex(\Drupal\search_api\IndexInterface $index,
+ * Modules can alter Search API display properties. Some of them are described in
+ * \Drupal\search_api\Annotation\SearchApiDisplay.

80 cols. We should probably describe the array here. See search_api/src/Plugin/search_api/display/ViewsDisplayDeriver.php::getDisplaysForView

sinn’s picture

Status: Needs work » Needs review
StatusFileSize
new5.35 KB
new1.63 KB

Have not found example of "describe the array here". Also display properties can be different so I added example of $displays variable for views from search_api_test_views module. Hope it is enough.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Looks great! Thanks!

drunken monkey’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new5.41 KB
new4.07 KB

Good job, thanks!
I don't agree with Joris here, though: we never specify what the plugin definitions look like, for any of the other plugin types, so why should we do it here?
It's the same for all types (not just here, but throughout Core and contrib) anyways: look at the annotation and, possible, through the plugin base class; and apart from that, it can vary from plugin to plugin – no use getting more specific there (or, as it's now, just listing the complete definition for one example of a plugin).

Status: Needs review » Needs work

The last submitted patch, 8: 2733185-8--document_and_test_plugin_alter_hooks.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

you're right. Sorry for making you do unneeded work @sinn

  • drunken monkey committed f172af0 on 8.x-1.x authored by sinn
    Issue #2733185 by sinn, drunken monkey: Added documentation and tests...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for reviewing (and agreeing) – committed!
Thanks again, sinn!

Status: Fixed » Closed (fixed)

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