Closed (fixed)
Project:
Drupal core
Version:
main
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
6 Feb 2026 at 19:04 UTC
Updated:
20 Mar 2026 at 19:45 UTC
Jump to comment: Most recent
hook_icon_pack_alter() is entirely undocumented.
-
Document it!
-
-
-
-
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:
Comments
Comment #2
kanchanandhini6 commentedHello,
I would like to work on this issue as a first-time contributor.
Please let me know if I can proceed.
Thank you.
Comment #3
tstoecklerHey @kanchanandhini6 that's awesome, sure thing! Feel free to assign the issue to yourself.
Some pointers that hopefully help:
core.api.phpfilehook_validation_constraint_alter()for example. Even though it's a completely different part of core, the hook documentation should look somewhat similar.navigation.icons.yml, to see which keys are available. As a reference for how such an array can be documented, take a look at\Drupal\Core\Asset\LibraryDiscoveryParser::parseLibraryInfo(). But again, feel free to ignore this point for now if it's a bit too much or bit too confusing.Let me know if there's anything else that's unclear or if you need help with the contribution workflow in general.
Comment #4
kanchanandhini6 commentedComment #5
kanchanandhini6 commentedI’ve added documentation for hook_icon_pack_alter() in core/core.api.php and pushed the changes to my issue branch (icon-pack-alter-doc).
Please review and let me know if any changes are needed.
Thanks!
Comment #6
tstoecklerI don't see any issue branch (or an issue fork where that branch would live, for that matter). Can you point me to where you pushed the code?
Comment #8
kanchanandhini6 commentedComment #9
smustgrave commentedI don't see anywhere in core icon_pack_alter is called? And @see core/modules/navigation/navigation.icons.yml not sure how that relates to alter. Sorry putting back into NW.
Comment #10
tstoecklerRe #9: See
\Drupal\Core\Theme\Icon\Plugin\IconPackManager::__construct(). Through the use of$this->alterInfo()hook_icon_pack_alter()will be called during plugin discovery automatically. Yeah, the @see is a bit unfortunate without further explanation, I agree, so I'd vote to remove that as well, for now.Will do a detailed code review now.
Comment #11
tstoecklerOpened #3572674: Allow themes to call hook_icon_pack_alter() for the follow-up.
Comment #12
kanchanandhini6 commentedComment #13
tstoecklerAwesome, thanks for the quick follow-up @kanchanandhini6! Looks perfect now and PHPCS is happy as well. I think it's good to go.
Comment #14
nicxvan commentedShould this be in theme.api.php?
Comment #15
tstoecklerGood question @nicxvan. I totally didn't know
theme.api.phpexists. I took a look whether that only contains hooks that are actually invoked in themes vs. just being generally theme related, but that's not the case. For examplehook_library_info_build()is documented there, which is only for modules.hook_icon_pack_alter()seems similar enough in that it's theme or rendering related. So I would say, yes, let's move it totheme.api.php(that's incore/lib/Drupal/Core/Render, regardless of the outcome of #3572674: Allow themes to call hook_icon_pack_alter().Marking needs work for that, are you up for moving the documentation over to the other file @kanchanandhini6?
Comment #16
kanchanandhini6 commented"I have moved the hook_icon_pack_alter() documentation from core.api.php to core/lib/Drupal/Core/Render/theme.api.php as suggested by @nicxvan and @tstoeckler.
Setting back to Needs review."
Comment #17
kanchanandhini6 commentedComment #18
kanchanandhini6 commented"I have moved the hook_icon_pack_alter() documentation to core/lib/Drupal/Core/Render/theme.api.php as requested in comment #15.
I noticed some CI failures in the latest pipeline, but they appear to be environment-related ('Insufficient cpu') rather than issues with the code.
Setting back to Needs review."
Comment #19
tstoeckler@kanchanandhini6 thanks for the quick response, awesome!
One tiny thing: in
theme.api.phpthe new hook is now outside of the "hook" documentation group, so if you could move it up to be inside of that, that would be perfect.Comment #20
kanchanandhini6 commentedComment #21
tstoecklerAwesome, thanks, looks great!
Comment #25
alexpottCommitted 65b0772 and pushed to main. Thanks!
Committed 3b859e0 and pushed to 11.x. Thanks!
Committed 81400d4 and pushed to 11.3.x. Thanks!