-
Notifications
You must be signed in to change notification settings - Fork 0
Add flatten-proof phase colour and a phase-services dynamic block (LSA-132) #72
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
Open
brandonmarshal
wants to merge
5
commits into
feature/ls-4179-build-discover-page
from
feature/ls-4179-phase-colour-and-services-block
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7dd6dae
Add flatten-proof phase colour and a phase-services dynamic block
brandonmarshal 41e5380
Add CHANGELOG entry for PR #72
brandonmarshal 86787d7
Fix phase-services editor preview defaulting to Discover
brandonmarshal 784a584
Fix short ternary and declare postId context for phase-services
brandonmarshal db8a989
Make phase hero accents follow the current phase
brandonmarshal 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,11 @@ | ||
| { | ||
| "$schema": "https://schemas.wp.org/trunk/block.json", | ||
| "apiVersion": 3, | ||
| "name": "ls-theme/phase-services", | ||
| "title": "Phase Services", | ||
| "category": "text", | ||
| "description": "Renders the current lifecycle phase page's \"Services in this phase\" heading and service cards. Implements CodeRabbit's request-time rendering fix for patterns/sections/phase-services-in-phase.php: PHP phase-detection baked into a pattern's own content only re-evaluates while the pattern stays a live wp:pattern reference, and is lost if WordPress flattens it, so the phase-dependent selection and markup now live in this dynamic block's render.php instead, which runs at real request time regardless of how the surrounding pattern is stored.", | ||
| "textdomain": "ls-theme", | ||
| "usesContext": [ "postId" ], | ||
| "render": "file:./render.php" | ||
| } |
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,34 @@ | ||
| /** | ||
| * Editor-side registration for ls-theme/phase-services. | ||
| * | ||
| * The PHP registration in inc/blocks.php (register_block_type against this folder's block.json) | ||
| * only tells WordPress how to render this block on the front end — the block editor's own JS | ||
| * registry is entirely separate, and needs its own wp.blocks.registerBlockType() call by the same | ||
| * name or it shows "Your site doesn't include support for this block" and renders nothing in the | ||
| * canvas. ServerSideRender is used for `edit` (rather than reimplementing the markup in JS) so the | ||
| * editor preview always matches render.php's actual output, including the current phase's real | ||
| * content and colour — no separate editor-only representation to keep in sync. | ||
| * | ||
| * Plain global-based script (no build step), per AGENTS.md "Avoid inventing a build pipeline". | ||
| * | ||
| * @package ls-theme | ||
| */ | ||
| ( function ( blocks, element, serverSideRender ) { | ||
| var el = element.createElement; | ||
|
|
||
| blocks.registerBlockType( 'ls-theme/phase-services', { | ||
| title: 'Phase Services', | ||
| category: 'text', | ||
| usesContext: [ 'postId' ], | ||
| description: 'Renders the current phase page\'s "Services in this phase" heading and service cards.', | ||
| edit: function ( props ) { | ||
| return el( serverSideRender, { | ||
| block: 'ls-theme/phase-services', | ||
| urlQueryArgs: { post_id: props.context ? props.context.postId : undefined }, | ||
| } ); | ||
| }, | ||
| save: function () { | ||
| return null; | ||
| }, | ||
| } ); | ||
| } )( window.wp.blocks, window.wp.element, window.wp.serverSideRender ); | ||
Oops, something went wrong.
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.