Skip to content

[GOVRACPROD-44] Create Block visibility interface.#54

Closed
g2410g wants to merge 19 commits intofeature/GOVRACPROD-45from
feature/GOVRACPROD-44-2
Closed

[GOVRACPROD-44] Create Block visibility interface.#54
g2410g wants to merge 19 commits intofeature/GOVRACPROD-45from
feature/GOVRACPROD-44-2

Conversation

@g2410g
Copy link
Collaborator

@g2410g g2410g commented Jan 13, 2026

https://salsadigital.atlassian.net/browse/GOVRACPROD-44

Checklist before requesting a review

  • I have formatted the subject to include ticket number as [#123] Verb in past tense with dot at the end.
  • I have added a link to the issue tracker
  • I have provided information in Changed section about WHY something was done if this was not a normal implementation
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have run new and existing relevant tests locally with my changes, and they passed
  • I have provided screenshots, where applicable

Changed

  1. Create new Block Rules and Block Rule Paragraph.
  2. Add fields to component block type.
  3. Update logic to render the blocks.

Screenshots

@g2410g g2410g changed the base branch from 1.x to feature/GOVRACPROD-45 January 13, 2026 00:56
@g2410g g2410g changed the title [DO NOT MERGE] Feature/govracprod 44 2 [GOVRACPROD-44] Create Block visibility interface. Jan 13, 2026
* Implements hook_preprocess_block();
*/
function webform_openfisca_preprocess_block(array &$variables): void {
// Get the block ID.
Copy link
Contributor

Choose a reason for hiding this comment

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

@g2410g We need to make sure that this function applies only to the blocks that have a rule associated with them

Copy link
Contributor

Choose a reason for hiding this comment

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

Check against the findRacBlockContentForWebform function

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gargsuchi Done.

$current_block_id = $query['blocks'] ?? NULL;
$current_block_ids = explode(',', $current_block_id);

if ($block_content && $block_content->bundle() == 'civictheme_component_block') {
Copy link
Contributor

Choose a reason for hiding this comment

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

@g2410g
We can not hard-code this block type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gargsuchi Done.

/**
* Implements hook_preprocess_block().
*/
function webform_openfisca_preprocess_block(array &$variables): void {
Copy link
Contributor

@gargsuchi gargsuchi Jan 14, 2026

Choose a reason for hiding this comment

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

@g2410g We should try and use this hook instead hook_block_access

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gargsuchi Done.

@g2410g g2410g force-pushed the feature/GOVRACPROD-44-2 branch from 0e83f39 to 3216b89 Compare January 15, 2026 02:36
}

/** @var \Drupal\Core\Entity\ContentEntityStorageInterface $block_content_storage */
$block_content_storage = $this->entityTypeManager->getStorage('block_content');
Copy link
Contributor

Choose a reason for hiding this comment

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

@g2410g Can you help me understand this logic?
field_block_rac_element is a field for the Block RAC Elements paragraph type.
How will it have the paragraph_ids from above? They are paragraphs of the type field_block_webform

@gargsuchi gargsuchi deleted the branch feature/GOVRACPROD-45 January 19, 2026 22:26
@gargsuchi gargsuchi closed this Jan 19, 2026
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.

2 participants