-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update all services blocks to use node contexts
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).
- Loading branch information
1 parent
e65add6
commit 2fbf3d2
Showing
12 changed files
with
106 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,24 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* LocalGov services install file. | ||
*/ | ||
|
||
/** | ||
* Add node_route context mapping to localgov_service_cta_block. | ||
*/ | ||
function localgov_services_update_8001() { | ||
$entity_type_manager = \Drupal::entityTypeManager(); | ||
$cta_blocks = $entity_type_manager->getStorage('block')->loadByProperties([ | ||
'plugin' => 'localgov_service_cta_block', | ||
]); | ||
|
||
foreach ($cta_blocks as $block) { | ||
$settings = $block->get('settings'); | ||
// Modify settings. | ||
$settings['context_mapping']['node'] = '@node.node_route_context:node'; | ||
$block->set('settings', $settings); | ||
$block->save(); | ||
} | ||
} |
This file contains 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 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 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 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 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