Skip to content

Commit

Permalink
All base theme templates is now checks for block variables definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklan committed May 19, 2022
1 parent 1f940d2 commit 56ae6d6
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Rename variables `title_classes` to `classes` in `page-title.html.twig`.
- Fixed `menu.html.twig` which didn't reset `attributes` for submenu which leads to duplicated classes and wrong BEM structure.
- All base theme templates is now checks for `block` variables definition. This allows to override its value in extended templates without need to rewrite whole template just for it.

### Starter theme

Expand Down
2 changes: 1 addition & 1 deletion templates/content/comment/comment.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%
set block = bem_block([
set block = block ?? bem_block([
comment.getEntityTypeId(),
comment.bundle() != comment.getEntityTypeId() ? comment.bundle(),
view_mode != 'default' ? view_mode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%
set block = bem_block([
set block = block ?? bem_block([
product_entity.getEntityTypeId(),
product_entity.bundle(),
view_mode != 'default' ? view_mode,
Expand Down
2 changes: 1 addition & 1 deletion templates/content/media/media.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%
set block = bem_block([
set block = block ?? bem_block([
media.getEntityTypeId(),
media.bundle() != media.getEntityTypeId() ? media.bundle(),
view_mode != 'default' ? view_mode,
Expand Down
2 changes: 1 addition & 1 deletion templates/content/node/node.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%
set block = bem_block([
set block = block ?? bem_block([
node.entityTypeId(),
node.bundle(),
view_mode != 'default' ? view_mode,
Expand Down
2 changes: 1 addition & 1 deletion templates/content/paragraph/paragraph.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%
set block = bem_block([
set block = block ?? bem_block([
paragraph.entityTypeId(),
paragraph.bundle() != paragraph.entityTypeId() ? paragraph.bundle(),
view_mode != 'default' ? view_mode,
Expand Down
2 changes: 1 addition & 1 deletion templates/content/taxonomy-term/taxonomy-term.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%
set block = bem_block([
set block = block ?? bem_block([
term.entityTypeId(),
term.bundle() != term.entityTypeId() ? term.bundle(),
view_mode != 'default' ? view_mode,
Expand Down
2 changes: 1 addition & 1 deletion templates/content/user/user.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{%
set block = bem_block([
set block = block ?? bem_block([
user.entityTypeId(),
user.bundle() != user.entityTypeId() ? user.bundle(),
view_mode != 'default' ? view_mode,
Expand Down
2 changes: 1 addition & 1 deletion templates/views/views-view.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set block = css_name ? css_name : 'views' %}
{% set block = block ?? css_name ? css_name : 'views' %}
{%
set modifiers = [
block == 'views' ? id,
Expand Down

0 comments on commit 56ae6d6

Please sign in to comment.