Skip to content

Commit 0e8a2c2

Browse files
committed
Issue #3027236 by rachel_norfolk, kjay, tonypaulbarker, akshay_d, shaal, Eli-T, Not Real, babusaheb.vikas: Umami - hero block is identical on Home and Recipe pages, so potentially confusing
(cherry picked from commit f25412a)
1 parent 44ddeda commit 0e8a2c2

File tree

5 files changed

+79
-10
lines changed

5 files changed

+79
-10
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
langcode: en
2+
status: true
3+
dependencies:
4+
content:
5+
- 'block_content:banner_block:9aadf4a1-ded6-4017-a10d-a5e043396edf'
6+
enforced:
7+
module:
8+
- demo_umami_content
9+
module:
10+
- block_content
11+
- system
12+
theme:
13+
- umami
14+
id: umami_banner_home
15+
theme: umami
16+
region: banner_top
17+
weight: -7
18+
provider: null
19+
plugin: 'block_content:9aadf4a1-ded6-4017-a10d-a5e043396edf'
20+
settings:
21+
id: 'block_content:9aadf4a1-ded6-4017-a10d-a5e043396edf'
22+
label: 'Umami Home Banner'
23+
provider: block_content
24+
label_display: '0'
25+
status: true
26+
info: ''
27+
view_mode: full
28+
visibility:
29+
request_path:
30+
id: request_path
31+
pages: '<front>'
32+
negate: false
33+
context_mapping: { }

profiles/demo_umami/config/optional/block.block.umami_banner_recipes.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
id: umami_banner_recipes
1515
theme: umami
1616
region: banner_top
17-
weight: -10
17+
weight: -8
1818
provider: null
1919
plugin: 'block_content:4c7d58a3-a45d-412d-9068-259c57e40541'
2020
settings:
@@ -28,6 +28,6 @@ settings:
2828
visibility:
2929
request_path:
3030
id: request_path
31-
pages: "/recipes\r\n<front>"
31+
pages: "/recipes\r\n"
3232
negate: false
3333
context_mapping: { }
256 KB
Loading

profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ protected function importPages() {
329329
protected function importBlockContent() {
330330
$module_path = $this->moduleHandler->getModule('demo_umami_content')->getPath();
331331
$block_content_entities = [
332-
'umami_recipes_banner' => [
333-
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
334-
'info' => 'Umami Recipes Banner',
332+
'umami_home_banner' => [
333+
'uuid' => '9aadf4a1-ded6-4017-a10d-a5e043396edf',
334+
'info' => 'Umami Home Banner',
335335
'type' => 'banner_block',
336336
'field_title' => [
337337
'value' => 'Super easy vegetarian pasta bake',
@@ -342,7 +342,7 @@ protected function importBlockContent() {
342342
$node = reset($nodes);
343343
return $this->aliasManager->getAliasByPath('/node/' . $node->id());
344344
}),
345-
'title' => 'Super easy vegetarian pasta bake',
345+
'title' => 'View recipe',
346346
],
347347
'field_summary' => [
348348
'value' => 'A wholesome pasta bake is the ultimate comfort food. This delicious bake is super quick to prepare and an ideal midweek meal for all the family.',
@@ -352,6 +352,29 @@ protected function importBlockContent() {
352352
'alt' => 'Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings',
353353
],
354354
],
355+
'umami_recipes_banner' => [
356+
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
357+
'info' => 'Umami Recipes Banner',
358+
'type' => 'banner_block',
359+
'field_title' => [
360+
'value' => 'Vegan chocolate and nut brownies',
361+
],
362+
'field_content_link' => [
363+
'uri' => 'internal:' . call_user_func(function () {
364+
$nodes = $this->entityTypeManager->getStorage('node')->loadByProperties(['title' => 'Vegan chocolate and nut brownies']);
365+
$node = reset($nodes);
366+
return $this->aliasManager->getAliasByPath('/node/' . $node->id());
367+
}),
368+
'title' => 'View recipe',
369+
],
370+
'field_summary' => [
371+
'value' => 'These sumptuous brownies should be gooey on the inside and crisp on the outside. A perfect indulgence!',
372+
],
373+
'field_banner_image' => [
374+
'target_id' => $this->createFileEntity($module_path . '/default_content/images/vegan-brownies-hero-umami.jpg'),
375+
'alt' => 'A stack of chocolate and pecan brownies, sprinkled with pecan crumbs and crushed walnut, fresh out of the oven',
376+
],
377+
],
355378
'umami_disclaimer' => [
356379
'uuid' => '9b4dcd67-99f3-48d0-93c9-2c46648b29de',
357380
'info' => 'Umami disclaimer',

profiles/demo_umami/modules/demo_umami_content/tests/src/Functional/UninstallDefaultContentTest.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public function testReinstall() {
7373
$this->assertRecipesImported($node_storage);
7474
$this->assertArticlesImported($node_storage);
7575
$this->assertImportedCustomBlock($block_storage);
76-
7776
}
7877

7978
/**
@@ -120,16 +119,19 @@ protected function assertArticlesImported(EntityStorageInterface $node_storage)
120119
*/
121120
protected function assertImportedCustomBlock(EntityStorageInterface $block_storage) {
122121
$assert = $this->assertSession();
123-
$this->drupalGet('/recipes');
124122
foreach ($this->expectedBlocks() as $block_info) {
123+
$this->drupalGet($block_info['path']);
124+
125125
// Verify that the block is placed.
126126
$assert->pageTextContains($block_info['unique_text']);
127+
127128
// For blocks that have image alt text, also verify the presence of the
128129
// expected alt text.
129130
if (isset($block_info['image_alt_text'])) {
130131
$img_alt_text = $assert->elementExists('css', $block_info['image_css_selector'])->getAttribute('alt');
131132
$this->assertEquals($block_info['image_alt_text'], $img_alt_text);
132133
}
134+
133135
// Verify that the block can be loaded.
134136
$count = $block_storage->getQuery()
135137
->condition('type', $block_info['type'])
@@ -147,18 +149,29 @@ protected function assertImportedCustomBlock(EntityStorageInterface $block_stora
147149
protected function expectedBlocks() {
148150
return [
149151
[
152+
'path' => '<front>',
150153
'type' => 'banner_block',
151-
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
154+
'uuid' => '9aadf4a1-ded6-4017-a10d-a5e043396edf',
152155
'unique_text' => 'A wholesome pasta bake is the ultimate comfort food.',
153-
'image_css_selector' => '#block-umami-banner-recipes img',
156+
'image_css_selector' => '#block-umami-banner-home img',
154157
'image_alt_text' => 'Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings',
155158
],
156159
[
160+
'path' => '/recipes',
161+
'type' => 'banner_block',
162+
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
163+
'unique_text' => 'These sumptuous brownies should be gooey on the inside and crisp on the outside. A perfect indulgence!',
164+
'image_css_selector' => '#block-umami-banner-recipes img',
165+
'image_alt_text' => 'A stack of chocolate and pecan brownies, sprinkled with pecan crumbs and crushed walnut, fresh out of the oven',
166+
],
167+
[
168+
'path' => '/recipes',
157169
'type' => 'disclaimer_block',
158170
'uuid' => '9b4dcd67-99f3-48d0-93c9-2c46648b29de',
159171
'unique_text' => 'is a fictional magazine and publisher for illustrative purposes only',
160172
],
161173
[
174+
'path' => '/recipes',
162175
'type' => 'footer_promo_block',
163176
'uuid' => '924ab293-8f5f-45a1-9c7f-2423ae61a241',
164177
'unique_text' => 'Magazine exclusive articles, recipes and plenty of reasons to get your copy today.',

0 commit comments

Comments
 (0)