Abilities Explorer: Add a filter to customize the Ability Table class and expose ability meta#714
Draft
i-anubhav-anand wants to merge 1 commit into
Conversation
…ity meta Adds a wpai_abilities_explorer_table_class filter so plugins can provide a subclass of Ability_Table (e.g. to add custom columns), and includes the ability meta at the top level of formatted abilities so custom columns can render metadata without reaching into raw_data. Closes WordPress#203
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Closes #203
Adds an extensibility hook so plugins can provide their own
Ability_Tablesubclass for the Abilities Explorer list table, and exposes each ability'smetaat the top level of the formatted ability data so custom columns can render metadata.Why?
There is currently no way for third-party plugins to add custom columns to the Abilities Explorer table without modifying plugin files. The motivating use case from the issue: displaying which abilities support MCP directly in the table view.
How?
wpai_abilities_explorer_table_classfilter inAdmin_Page::render_list_view(). The issue proposedai_abilities_explorer_table_class, but this PR follows the plugin's existingwpai_filter prefix convention (wpai_settings_feature_metadata,wpai_ability_category, …). The filtered value is validated withis_a( $table_class, Ability_Table::class, true )and silently falls back to the default class, so a bad filter return can't fatal the admin page.Ability_Handler::format_single_ability()now includes'meta' => $metaat the top level. The copy nested inraw_datais kept for backwards compatibility.metaand asserting it is exposed at the top level.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Fable 5
Used for: Implementation and test drafting under my direction; I reviewed the changes and take responsibility for them.
Testing Instructions
Ability_Table, adds a column reading$item['meta'], and returns the subclass name from thewpai_abilities_explorer_table_classfilter.npm run test:php -- --filter Ability_HandlerTestand confirm the newtest_get_ability_includes_meta_at_top_leveltest passes.