-
Notifications
You must be signed in to change notification settings - Fork 45
feat: add tag labels support to Content Loop block #2282
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4f1b29f
feat: add tag labels support to Content Loop block
jason10lee ed7bf93
fix: apply Copilot suggestions
jason10lee 736510c
chore: lint Copilot suggestions
jason10lee 34ec1e0
Merge branch 'trunk' into feat/tag-labels
jason10lee 9c9f3d7
refactor: switch to the centralized tag display function
jason10lee 1e3ab53
fix: missing `tag-label` class
jason10lee 0a96747
refactor: update to use structure from `get_tag_labels()` directly
jason10lee f4c9a19
feat: add showTagLabels block attribute + Inspector toggle
jason10lee b0f2416
fix: neutralize tag-label preview anchors in editor
jason10lee 54d58c1
Merge branch 'trunk' into feat/tag-labels
jason10lee 1319aa9
refactor: drop unused Newspack_Blocks::generate_tag_labels()
jason10lee 7b1dd8f
test: cover newspack_tag_labels REST field shape
jason10lee dc469f8
Merge branch 'trunk' into feat/tag-labels
jason10lee 29923d5
perf: skip tag-label lookup when the block hides labels
jason10lee c896205
docs: mark display_tag_labels $labels param as nullable
jason10lee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName | ||
| /** | ||
| * Test stub for \Newspack\Tag_Labels. | ||
| * | ||
| * The newspack-blocks test suite runs without newspack-plugin loaded, so the | ||
| * real \Newspack\Tag_Labels class is absent. This lightweight stub lets the | ||
| * tests exercise the tag-label REST pass-through contract in isolation. | ||
| * | ||
| * @package Newspack_Blocks | ||
| */ | ||
|
|
||
| // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound -- Test stub deliberately impersonates the plugin's \Newspack\Tag_Labels. | ||
| namespace Newspack; | ||
|
|
||
| if ( ! class_exists( __NAMESPACE__ . '\Tag_Labels' ) ) { | ||
| /** | ||
| * Minimal stub of the plugin's Tag_Labels class. | ||
| */ | ||
| class Tag_Labels { | ||
| /** | ||
| * Labels returned by get_labels_for_post(). Set by the test. | ||
| * | ||
| * @var array|null | ||
| */ | ||
| public static $stub_labels = null; | ||
|
|
||
| /** | ||
| * Return the stubbed labels, ignoring the post. | ||
| * | ||
| * @param int|\WP_Post|null $post Post to look up (ignored by the stub). | ||
| * @return array|null | ||
| */ | ||
| public static function get_labels_for_post( $post ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Signature parity with the real class; the stub ignores the post. | ||
| return self::$stub_labels; | ||
| } | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.