Skip to content

fix: proxy context-aware methods to target block - #34

Merged
e0ipso merged 7 commits into
mainfrom
fix-proper-context-proxy
May 26, 2026
Merged

e0ipso merged 7 commits into
mainfrom
fix-proper-context-proxy

Conversation

@e0ipso

@e0ipso e0ipso commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Override context-aware methods on ProxyBlock so context lookups, mappings, and definitions delegate to the configured target block.
  • Replace the in-form context mapping element with a warning explaining that context mapping is only available after the block is saved.

Test plan

  • Place a context-aware block (e.g. one requiring a node context) via the proxy block in Layout Builder and confirm it renders with the correct context.
  • Add a new proxy block targeting a context-aware block and verify the warning is displayed before save.
  • Edit the saved proxy block and confirm the context mapping form becomes available.

Override context methods on ProxyBlock to delegate to the target block,
and warn in the form when context mapping is only available after save.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements context mapping support for the ProxyBlock plugin and updates the TargetBlockFormProcessor to handle context definitions. The code reviewer identified several critical issues in ProxyBlock.php, including a fatal runtime error caused by using the null coalescing assignment operator (??=) on a method return value, a bug where the literal string 'name' is passed instead of the $name variable in getContextDefinition(), and an incorrect fallback array key (context_definition instead of context_definitions) in getContextDefinitions(). Additionally, it was recommended to use $this->t() instead of the global t() function in TargetBlockFormProcessor.php for translation consistency.

Comment thread src/Plugin/Block/ProxyBlock.php Resolved
Comment thread src/Plugin/Block/ProxyBlock.php Resolved
Comment thread src/Plugin/Block/ProxyBlock.php Resolved
Comment thread src/Plugin/Block/ProxyBlock.php Resolved
@e0ipso
e0ipso merged commit e973fff into main May 26, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.6.5 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant