Add wp widget patch command for nested option updates#72
Merged
swissspidy merged 8 commits intomainfrom Mar 16, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add patch options for widget fields
Add Mar 14, 2026
wp widget patch command for nested option updates
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new wp widget patch subcommand to support “patch-style” edits (insert/update/delete) of nested widget option values, aligning widget management with other WP‑CLI patch patterns.
Changes:
- Introduces
Widget_Command::patch()usingRecursiveDataStructureTraverserto insert/update/delete nested option keys. - Adds Behat coverage for basic patch update/insert/delete flows and error cases.
- Registers
widget patchin the package’s bundled command list.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/Widget_Command.php |
Adds the patch subcommand implementation and wires it into widget option persistence. |
features/widget.feature |
Adds a Behat scenario covering basic widget patch behavior and error handling. |
composer.json |
Exposes widget patch as a bundled command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
swissspidy
reviewed
Mar 16, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
swissspidy
reviewed
Mar 16, 2026
swissspidy
reviewed
Mar 16, 2026
Co-authored-by: Pascal Birchler <pascal.birchler@gmail.com>
swissspidy
reviewed
Mar 16, 2026
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
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.
patchmethod toWidget_Commandclass insrc/Widget_Command.phpuse WP_CLI\Traverser\RecursiveDataStructureTraverser;importpatchmethod following Option_Command pattern from entity-commandwidget patchincomposer.jsonextra.commandsfeatures/widget.featureecho 'null' | wp widget patch update ... --format=jsontest casecomposer lint) — ✅ passedcomposer phpcs) — ✅ passedcomposer phpstan) — ✅ passedOriginal prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.