Problem/Motivation

I was looking at captcha.api.php for some custom development plans on top of captcha, and I noticed that one of the examples there was for a hook_menu() implementation, which no longer exists since D8.

/**
 * Implements hook_menu().
 *
 * Validation of the answer against the solution and other stuff is done by the
 * base CAPTCHA module.
 * === Recommended: hook_menu($may_cache) ===
 * More advanced CAPTCHA modules probably want some configuration page.
 * To integrate nicely with the base CAPTCHA module you should offer your
 * configuration page as a MENU_LOCAL_TASK menu entry under
 * 'admin/config/people/captcha/'.
 * For our simple foo CAPTCHA module this would mean:
 */
function foo_captcha_menu($may_cache) {
  $items = [];
  if ($may_cache) {
    $items['admin/config/people/captcha/foo_captcha'] = [
      'title' => t('Foo CAPTCHA'),
      'page callback' => 'drupal_get_form',
      'page arguments' => ['foo_captcha_settings_form'],
      'type' => MENU_LOCAL_TASK,
    ];
  }
  return $items;
}

In Drupal 8/9, this would be replaced by a configuration form class, a routing entry for it, and a task entry for the menu. None of which are Drupal hooks.

I think we can remove this example completely, to avoid possible confusion.

Proposed resolution

Remove hook_menu() example.

Remaining tasks

Remove hook_menu() example.

User interface changes

None.

API changes

None. That file serves only as a guide/documentation.

Data model changes

None. That file serves only as a guide/documentation.

Issue fork captcha-3228824

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gueguerreiro created an issue. See original summary.

gueguerreiro’s picture

Assigned: gueguerreiro » Unassigned
Priority: Normal » Minor
Status: Active » Needs review

Opened a PR for this small change. Changing the priority to Minor, since this is not coding related.

Anybody’s picture

Status: Needs review » Reviewed & tested by the community

Correct! RTBC'd!

podarok made their first commit to this issue’s fork.

  • podarok committed 188680a on 8.x-1.x authored by gueguerreiro
    Issue #3228824: Remove hook_menu example from captcha.api.php since it...
podarok’s picture

Status: Reviewed & tested by the community » Fixed

Thanks

Status: Fixed » Closed (fixed)

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