Skip to content
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

Update service blocks to use a node route context #236

Draft
wants to merge 2 commits into
base: 2.x
Choose a base branch
from

Conversation

andybroomfield
Copy link
Contributor

Fix #116

Changes the way services blocks get the current node, by changing from using the current route in the constructor and using a context mapping for the node route.
This allows the correct contents of the blocks to display in other modules such as layout builder.

To achive this, the provided blocks will need to be updated on existing sites with the update hook provided, this will add the required node context to the CTA, releated links and releated topics blocks.
The existing $this->node method is still present for backward compatability for other blocks that extend servicesBlockBase until they are updated to use the node route context value.

@andybroomfield andybroomfield force-pushed the fix/116-layout-builder-block-support branch from 8524580 to 2fbf3d2 Compare December 10, 2023 16:09
@finnlewis finnlewis requested a review from ekes December 11, 2023 14:09
@finnlewis
Copy link
Member

finnlewis commented Apr 9, 2024

Discussing in Merge Tuesday:

  • @ekes thinks this makes sense insofar as we're removing the hard coding of a single node entity on the route, to allow configurable context (and support layout builder).
  • @andybroomfield still want check / write update hooks to switch contexts - will review and take out of draft when ready to review.

@finnlewis finnlewis assigned andybroomfield and unassigned rupertj Apr 9, 2024
Ref #116

Add the node context to the service blocks, this allows them to be used
with layout builder
Set a node context to all service blocks and update the block base and all service
block functions to use the contextValue('node') if present.

Update each of the provided blocks to set a context_mapping for the current node route
Provide update hooks for CTA, releated links and related topics blocks
Provide a backward compatible way of accessing the current node via $this->node
for blocks that have not updated to use a node context so they can still get the current
node. (todo: decide if this should then be deprecated).
@andybroomfield andybroomfield force-pushed the fix/116-layout-builder-block-support branch from 2fbf3d2 to 8b4547c Compare December 18, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add layout builder support for the Services blocks
3 participants