-
Notifications
You must be signed in to change notification settings - Fork 83
Add Tag transformer for WP_Term objects #2552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Introduces the Tag transformer class to handle WP_Term objects in the Factory. The Factory now returns a Tag instance for 'WP_Term' type, enabling transformation of terms to ActivityPub objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds support for transforming WordPress WP_Term objects into ActivityPub OrderedCollection objects. The implementation introduces a new Tag transformer class that handles taxonomy terms (tags, categories, and custom taxonomies) and integrates it into the existing transformer factory pattern.
Key Changes
- New
Tagtransformer class that convertsWP_Termobjects to ActivityPubOrderedCollectiontype - Factory pattern integration to automatically route
WP_Termobjects to the Tag transformer - Comprehensive test coverage for the new transformer and factory integration
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
includes/transformer/class-tag.php |
New transformer class that converts WP_Term objects to OrderedCollection ActivityPub objects with term link as ID |
includes/transformer/class-factory.php |
Added WP_Term case to factory switch statement to instantiate Tag transformer |
tests/phpunit/tests/includes/transformer/class-test-tag.php |
New test file with comprehensive coverage for Tag transformer functionality across different taxonomies |
tests/phpunit/tests/includes/transformer/class-test-factory.php |
Added test case and setup for WP_Term factory integration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Refactored the Tag transformer class to Term, updating all references and related test files. This change improves clarity by aligning the transformer name with the WP_Term object it handles.
Proposed changes:
Adds a new Tag transformer class to handle WP_Term objects, converting them to ActivityPub OrderedCollection objects. This enables support for turning tags, categories, and custom taxonomies into federated collections in the Reader view.
Tagclass inincludes/transformer/class-tag.phpFactory::get_transformer()Other information:
Testing instructions:
Factory::get_transformer( $term )to_object()and verify it returns an OrderedCollectionnpm run env-test -- --filter=Test_TagChangelog entry
Changelog Entry Details
Significance
Type
Message
Adds support for turning tags, categories, and custom taxonomies into federated collections in the Reader view so you can browse and follow topics more seamlessly.