Just noticed that hooks:

  • hook_plugin_filter_TYPE_alter
  • hook_plugin_filter_TYPE__CONSUMER_alter

Do not get auto-redirected to the actual documentation page by api.drupal.org.

On closer inspection, I noticed that these hooks only exist on 8.6.x+, which explains the 404 (api.drupal.org defaults to 8.2.x for the initial lookup).

A potential fix would be to get module builder to generate the url using the minor version on which it's running (e.g. 8.7.x), which should guarantee the API docs to always be found.

Comments

jedihe created an issue. See original summary.

jedihe’s picture

Here's a very simple fix.

In case it needs some improvement, please let me know and I can work on it.

jedihe’s picture

Status: Active » Needs review
joachim’s picture

Status: Needs review » Needs work

Thanks for reporting this, and for the patch!

> On closer inspection, I noticed that these hooks only exist on 8.6.x+, which explains the 404 (api.drupal.org defaults to 8.2.x for the initial lookup).

That's surely a bug in API module though.

+++ b/src/Form/ModuleHooksForm.php
@@ -86,7 +86,10 @@ class ModuleHooksForm extends ComponentFormBase {
+          $core_version_parts = explode('.', \Drupal::VERSION);
+          $core_version_parts[2] = 'x';
+          $core_version_minor = implode('.', $core_version_parts);
+          $url = Url::fromUri('https://api.drupal.org/api/function/' . $hook . '/' . $core_version_minor);

This needs comments to explain what it's doing.

joachim’s picture

jedihe’s picture

Status: Needs work » Needs review
StatusFileSize
new1014 bytes

Patch updated :)

  • joachim committed 8115e23 on 8.x-3.x authored by jedihe
    Issue #3085542 by jedihe: Fixed api.d.org documentation link not working...
joachim’s picture

Status: Needs review » Fixed

Committed!

Thanks for the updated patch. The comments are just right!

I'll make a new release.

jedihe’s picture

Great! :D

Status: Fixed » Closed (fixed)

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