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

OEL-1543: Rename block templates to target plugin ids instead of block ids. #137

Merged
merged 5 commits into from
Jun 8, 2022

Conversation

donquixote
Copy link
Contributor

This is needed so they still work in sub-themes.

Comment on lines 126 to 128
$form = $crawler->filter('#oe-whitelabel-search-form');
// The template removes block wrappers for this block.
$this->assertSame('body', $form->parents()->getNode(0)->tagName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$form = $crawler->filter('#oe-whitelabel-search-form');
// The template removes block wrappers for this block.
$this->assertSame('body', $form->parents()->getNode(0)->tagName);
$form = $crawler->filter('body > #oe-whitelabel-search-form');
// The template removes block wrappers for this block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like!
But now we have to move the comment elsewhere.

// Select the search form in the block.
// The block template removes the block wrapper, so the form is the root
// element.
$form = $crawler->filter('body > form#oe-whitelabel-search-form');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it adds clarity to also have form in the selector.

@@ -122,10 +122,10 @@ public function testBlockRendering(): void {
$render = $this->container->get('renderer')->renderRoot($build);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was going to rename the variables here, but I then decided to rather not touch this part.
E.g. $render -> $markup, $entity -> $block_entity.
We can do this another day.

brummbar
brummbar previously approved these changes May 17, 2022
drishu
drishu previously approved these changes May 18, 2022
*
* @see ./core/themes/stable/templates/block/block.html.twig
* @see \Drupal\facets_form\Plugin\Block\FacetsFormBlock
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These comments had changed in 1.x since before last rebase.
Please decide if my version or the 1.x version is preferable.

*
* @see ./core/themes/stable/templates/block/block.html.twig
* @see \Drupal\facets_summary\Plugin\Block\FacetsSummaryBlock
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These comments had changed in 1.x since before last rebase.
Please decide if my version or the 1.x version is preferable.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, think their better, since the location of the indicated block template should have been the block module not the stable theme

drishu
drishu previously approved these changes Jun 1, 2022
brummbar
brummbar previously approved these changes Jun 7, 2022
…wig.

The block had been renamed long ago in e6eadb0 / OEL-1192.
Interestingly the template was working with underscore.
But the correct way is to use dashes instead.
See also https://www.drupal.org/project/drupal/issues/2129665.
…ock id.

Update tests, because now the template also affects the block in SearchBlockTest.
@donquixote donquixote merged commit b216f49 into 1.x Jun 8, 2022
@donquixote donquixote deleted the OEL-1543 branch June 8, 2022 09:59
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.

3 participants