Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
…into backport/pr-82367
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
…into backport/pr-82367
…d search test. Co-Authored-By: Claude <noreply@anthropic.com>
|
I re-tested this PR and confirmed that all the feedback from the Gutenberg PR (WordPress/gutenberg#76481) has been properly backported here 👍 |
Registered icons can now define optional search keywords, and icon search in the registry and the REST API matches them as well as the icon's name and label. Developed in: #13672 Props n8finch, tayyiba66, wildworks. Fixes #66158. git-svn-id: https://develop.svn.wordpress.org/trunk@63999 602fd350-edb4-49c9-b593-d223f7449a82
Registered icons can now define optional search keywords, and icon search in the registry and the REST API matches them as well as the icon's name and label. Developed in: WordPress/wordpress-develop#13672 Props n8finch, tayyiba66, wildworks. Fixes #66158. Built from https://develop.svn.wordpress.org/trunk@63999 git-svn-id: http://core.svn.wordpress.org/trunk@63162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Backports WordPress/gutenberg#82367.
Registered icons can now carry an optional
keywordsproperty, and icon search matches against it in addition to the icon's name and label. Previously an icon could only be found by its namespaced name or its human-readable label, so an icon whose common name differs from its label (for examplecore/menu, widely known as a "hamburger" menu) was undiscoverable in the editor's icon picker unless the user happened to guess the label.This follows the same pattern as the label search added in [62551] for #64847.
Changes
WP_Icons_Registryregister()accepts an optionalkeywordsproperty. It must be an array of strings; anything else triggers_doing_it_wrong()and the icon is not registered. Accepted keywords are passed throughsanitize_text_field().icon_matches_search()encapsulates the match, testing the search term case-insensitively against the icon's name, label, and keywords.get_registered_icons()delegates to it, replacing the inlined name/label comparison.REST API (
WP_REST_Icons_Controller)keywordsis added to the item schema as a read-only array of strings.Core icon manifest
_wp_register_default_icons()passes a manifest entry'skeywordsthrough towp_register_icon().src/wp-includes/assets/icon-library-manifest.phpis regenerated from the Gutenberg branch, adding localized keywords to all 88 core icons. Keywords use theicon keywordtranslation context, matching the existingicon labelcontext.Testing instructions
Automated:
Eight new test methods cover registration with and without keywords, rejection of non-string and non-array values (seven data-provided cases), case-insensitive keyword matching, keyword search through the REST endpoint, and the empty-array default. The full
iconsgroup passes: 131 tests, 518 assertions.Manual testing requires the update to Gutenberg plugin: WordPress/gutenberg#82367
Trac ticket: https://core.trac.wordpress.org/ticket/66158
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Diagnosing failures in the initial backport commits, regenerating the icon manifest from the Gutenberg branch, correcting the REST controller's
keywordshandling, removing a test that covered a plugin-only code path with no Core equivalent, and aligning docblocks with the Inline Documentation Standards. I reviewed every change, ran the test suite, and take responsibility for the result.This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.