Document and test alter hooks in Vocabulary::view() plugin

Created on 14 August 2025, about 12 hours ago

Problem/Motivation

The \Drupal\taxonomy\Entity\Vocabulary plugin's ::view() function has an alter hook...

// @todo Test & Document
// Add an alter hook for modules to manipulate the taxonomy term output.
$this->moduleHandler->alter([
  'sitemap_vocabulary', 'sitemap_vocabulary_' . $vid,
], $list, $vid);

This defines a hook_sitemap_vocabulary_alter() and hook_sitemap_vocabulary_VID_alter() public API.

But as the comment says, we don't have a sitemap.api.php file to document that, and we don't have any tests.

Proposed resolution

Document the alter hooks in a sitemap.api.php file and add tests.

Remaining tasks

  1. Write a patch
  2. Review and feedback
  3. RTBC and feedback
  4. Commit
  5. Release

User interface changes

None.

API changes

Documents something that's already part of the public API. This increases its visibility, but isn't an API break.

Data model changes

None.

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada mparker17 UTC-4

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024