Issue #2942007 by David_Rothstein, navneet0693, andrewmacpherson: Move the footer promo block image to a field, for better configurability and accessibility
parent
39e2179807
commit
f00dc6733c
|
@ -4,9 +4,12 @@ dependencies:
|
||||||
config:
|
config:
|
||||||
- block_content.type.footer_promo_block
|
- block_content.type.footer_promo_block
|
||||||
- field.field.block_content.footer_promo_block.field_content_link
|
- field.field.block_content.footer_promo_block.field_content_link
|
||||||
|
- field.field.block_content.footer_promo_block.field_promo_image
|
||||||
- field.field.block_content.footer_promo_block.field_summary
|
- field.field.block_content.footer_promo_block.field_summary
|
||||||
- field.field.block_content.footer_promo_block.field_title
|
- field.field.block_content.footer_promo_block.field_title
|
||||||
|
- image.style.thumbnail
|
||||||
module:
|
module:
|
||||||
|
- image
|
||||||
- link
|
- link
|
||||||
id: block_content.footer_promo_block.default
|
id: block_content.footer_promo_block.default
|
||||||
targetEntityType: block_content
|
targetEntityType: block_content
|
||||||
|
@ -21,6 +24,14 @@ content:
|
||||||
third_party_settings: { }
|
third_party_settings: { }
|
||||||
type: link_default
|
type: link_default
|
||||||
region: content
|
region: content
|
||||||
|
field_promo_image:
|
||||||
|
weight: 4
|
||||||
|
settings:
|
||||||
|
progress_indicator: throbber
|
||||||
|
preview_image_style: thumbnail
|
||||||
|
third_party_settings: { }
|
||||||
|
type: image_image
|
||||||
|
region: content
|
||||||
field_summary:
|
field_summary:
|
||||||
weight: 2
|
weight: 2
|
||||||
settings:
|
settings:
|
||||||
|
|
|
@ -4,9 +4,12 @@ dependencies:
|
||||||
config:
|
config:
|
||||||
- block_content.type.footer_promo_block
|
- block_content.type.footer_promo_block
|
||||||
- field.field.block_content.footer_promo_block.field_content_link
|
- field.field.block_content.footer_promo_block.field_content_link
|
||||||
|
- field.field.block_content.footer_promo_block.field_promo_image
|
||||||
- field.field.block_content.footer_promo_block.field_summary
|
- field.field.block_content.footer_promo_block.field_summary
|
||||||
- field.field.block_content.footer_promo_block.field_title
|
- field.field.block_content.footer_promo_block.field_title
|
||||||
|
- image.style.medium_8_7
|
||||||
module:
|
module:
|
||||||
|
- image
|
||||||
- link
|
- link
|
||||||
id: block_content.footer_promo_block.default
|
id: block_content.footer_promo_block.default
|
||||||
targetEntityType: block_content
|
targetEntityType: block_content
|
||||||
|
@ -14,7 +17,7 @@ bundle: footer_promo_block
|
||||||
mode: default
|
mode: default
|
||||||
content:
|
content:
|
||||||
field_content_link:
|
field_content_link:
|
||||||
weight: 2
|
weight: 3
|
||||||
label: hidden
|
label: hidden
|
||||||
settings:
|
settings:
|
||||||
trim_length: 80
|
trim_length: 80
|
||||||
|
@ -25,15 +28,24 @@ content:
|
||||||
third_party_settings: { }
|
third_party_settings: { }
|
||||||
type: link
|
type: link
|
||||||
region: content
|
region: content
|
||||||
|
field_promo_image:
|
||||||
|
weight: 0
|
||||||
|
label: hidden
|
||||||
|
settings:
|
||||||
|
image_style: medium_8_7
|
||||||
|
image_link: ''
|
||||||
|
third_party_settings: { }
|
||||||
|
type: image
|
||||||
|
region: content
|
||||||
field_summary:
|
field_summary:
|
||||||
weight: 1
|
weight: 2
|
||||||
label: hidden
|
label: hidden
|
||||||
settings: { }
|
settings: { }
|
||||||
third_party_settings: { }
|
third_party_settings: { }
|
||||||
type: basic_string
|
type: basic_string
|
||||||
region: content
|
region: content
|
||||||
field_title:
|
field_title:
|
||||||
weight: 0
|
weight: 1
|
||||||
label: hidden
|
label: hidden
|
||||||
settings:
|
settings:
|
||||||
link_to_entity: false
|
link_to_entity: false
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
langcode: en
|
||||||
|
status: true
|
||||||
|
dependencies:
|
||||||
|
config:
|
||||||
|
- block_content.type.footer_promo_block
|
||||||
|
- field.storage.block_content.field_promo_image
|
||||||
|
module:
|
||||||
|
- image
|
||||||
|
id: block_content.footer_promo_block.field_promo_image
|
||||||
|
field_name: field_promo_image
|
||||||
|
entity_type: block_content
|
||||||
|
bundle: footer_promo_block
|
||||||
|
label: 'Promo image'
|
||||||
|
description: ''
|
||||||
|
required: false
|
||||||
|
translatable: false
|
||||||
|
default_value: { }
|
||||||
|
default_value_callback: ''
|
||||||
|
settings:
|
||||||
|
file_directory: '[date:custom:Y]-[date:custom:m]'
|
||||||
|
file_extensions: 'png gif jpg jpeg'
|
||||||
|
max_filesize: ''
|
||||||
|
max_resolution: ''
|
||||||
|
min_resolution: ''
|
||||||
|
alt_field: true
|
||||||
|
alt_field_required: false
|
||||||
|
title_field: false
|
||||||
|
title_field_required: false
|
||||||
|
default_image:
|
||||||
|
uuid: null
|
||||||
|
alt: ''
|
||||||
|
title: ''
|
||||||
|
width: null
|
||||||
|
height: null
|
||||||
|
handler: 'default:file'
|
||||||
|
handler_settings: { }
|
||||||
|
field_type: image
|
|
@ -0,0 +1,29 @@
|
||||||
|
langcode: en
|
||||||
|
status: true
|
||||||
|
dependencies:
|
||||||
|
module:
|
||||||
|
- block_content
|
||||||
|
- file
|
||||||
|
- image
|
||||||
|
id: block_content.field_promo_image
|
||||||
|
field_name: field_promo_image
|
||||||
|
entity_type: block_content
|
||||||
|
type: image
|
||||||
|
settings:
|
||||||
|
uri_scheme: public
|
||||||
|
default_image:
|
||||||
|
uuid: null
|
||||||
|
alt: ''
|
||||||
|
title: ''
|
||||||
|
width: null
|
||||||
|
height: null
|
||||||
|
target_type: file
|
||||||
|
display_field: false
|
||||||
|
display_default: false
|
||||||
|
module: image
|
||||||
|
locked: false
|
||||||
|
cardinality: 1
|
||||||
|
translatable: true
|
||||||
|
indexes: { }
|
||||||
|
persist_with_no_fields: false
|
||||||
|
custom_storage: false
|
|
@ -0,0 +1,13 @@
|
||||||
|
langcode: en
|
||||||
|
status: true
|
||||||
|
dependencies: { }
|
||||||
|
name: medium_8_7
|
||||||
|
label: 'Medium 8:7 (266x236)'
|
||||||
|
effects:
|
||||||
|
a7d919ee-5a34-476b-b893-c9649a621e60:
|
||||||
|
uuid: a7d919ee-5a34-476b-b893-c9649a621e60
|
||||||
|
id: image_scale_and_crop
|
||||||
|
weight: 1
|
||||||
|
data:
|
||||||
|
width: 266
|
||||||
|
height: 236
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
@ -348,6 +348,10 @@ class InstallHelper implements ContainerInjectionInterface {
|
||||||
}),
|
}),
|
||||||
'title' => 'Find out more',
|
'title' => 'Find out more',
|
||||||
],
|
],
|
||||||
|
'field_promo_image' => [
|
||||||
|
'target_id' => $this->createFileEntity($module_path . '/default_content/images/umami-bundle.png'),
|
||||||
|
'alt' => '3 issue bundle of the Umami food magazine',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -105,11 +105,11 @@ class UninstallDefaultContentTest extends BrowserTestBase {
|
||||||
foreach ($this->expectedBlocks() as $block_info) {
|
foreach ($this->expectedBlocks() as $block_info) {
|
||||||
// Verify that the block is placed.
|
// Verify that the block is placed.
|
||||||
$assert->pageTextContains($block_info['unique_text']);
|
$assert->pageTextContains($block_info['unique_text']);
|
||||||
// For the banner block, also verify the presence of alt text on the
|
// For blocks that have image alt text, also verify the presence of the
|
||||||
// banner image.
|
// expected alt text.
|
||||||
if ($block_info['type'] == 'banner_block') {
|
if (isset($block_info['image_alt_text'])) {
|
||||||
$img_alt_text = $assert->elementExists('css', '#block-umami-banner-recipes img')->getAttribute('alt');
|
$img_alt_text = $assert->elementExists('css', $block_info['image_css_selector'])->getAttribute('alt');
|
||||||
$this->assertEquals('Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings', $img_alt_text);
|
$this->assertEquals($block_info['image_alt_text'], $img_alt_text);
|
||||||
}
|
}
|
||||||
// Verify that the block can be loaded.
|
// Verify that the block can be loaded.
|
||||||
$count = $block_storage->getQuery()
|
$count = $block_storage->getQuery()
|
||||||
|
@ -131,6 +131,8 @@ class UninstallDefaultContentTest extends BrowserTestBase {
|
||||||
'type' => 'banner_block',
|
'type' => 'banner_block',
|
||||||
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
|
'uuid' => '4c7d58a3-a45d-412d-9068-259c57e40541',
|
||||||
'unique_text' => 'A wholesome pasta bake is the ultimate comfort food.',
|
'unique_text' => 'A wholesome pasta bake is the ultimate comfort food.',
|
||||||
|
'image_css_selector' => '#block-umami-banner-recipes img',
|
||||||
|
'image_alt_text' => 'Mouth watering vegetarian pasta bake with rich tomato sauce and cheese toppings',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'type' => 'disclaimer_block',
|
'type' => 'disclaimer_block',
|
||||||
|
@ -141,6 +143,8 @@ class UninstallDefaultContentTest extends BrowserTestBase {
|
||||||
'type' => 'footer_promo_block',
|
'type' => 'footer_promo_block',
|
||||||
'uuid' => '924ab293-8f5f-45a1-9c7f-2423ae61a241',
|
'uuid' => '924ab293-8f5f-45a1-9c7f-2423ae61a241',
|
||||||
'unique_text' => 'Magazine exclusive articles, recipes and plenty of reasons to get your copy today.',
|
'unique_text' => 'Magazine exclusive articles, recipes and plenty of reasons to get your copy today.',
|
||||||
|
'image_css_selector' => '#block-umami-footer-promo img',
|
||||||
|
'image_alt_text' => '3 issue bundle of the Umami food magazine',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
* This file is used to style the Footer promo block.
|
* This file is used to style the Footer promo block.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.block-type-footer-promo-block {
|
.block-type-footer-promo-block .field--type-image {
|
||||||
padding-top: 250px;
|
padding-bottom: 14px;
|
||||||
background: url('../../../../images/png/umami-bundle.png') no-repeat center top;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.block-type-footer-promo-block .block__title {
|
.block-type-footer-promo-block .block__title {
|
||||||
|
@ -19,7 +18,6 @@
|
||||||
|
|
||||||
.block-type-footer-promo-block .footer-promo-content a {
|
.block-type-footer-promo-block .footer-promo-content a {
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
clear: left;
|
|
||||||
display: block;
|
display: block;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -46,12 +44,21 @@
|
||||||
.block-type-footer-promo-block {
|
.block-type-footer-promo-block {
|
||||||
flex-basis: 60%;
|
flex-basis: 60%;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
padding-top: 0;
|
overflow: hidden;
|
||||||
padding-left: 280px;
|
|
||||||
background-position: left top;
|
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.block-type-footer-promo-block .field--type-image {
|
||||||
|
float: left; /* LTR */
|
||||||
|
margin-right: 14px; /* LTR */
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[dir="rtl"] .block-type-footer-promo-block .field--type-image {
|
||||||
|
float: right;
|
||||||
|
margin-left: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.block-type-footer-promo-block .block__title {
|
.block-type-footer-promo-block .block__title {
|
||||||
padding-top: 2rem;
|
padding-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
#}
|
#}
|
||||||
<div{{ attributes }}>
|
<div{{ attributes }}>
|
||||||
|
{{ content.field_promo_image }}
|
||||||
{{ title_prefix }}
|
{{ title_prefix }}
|
||||||
{% if label %}
|
{% if label %}
|
||||||
<h2{{ title_attributes }}>{{ label }}</h2>
|
<h2{{ title_attributes }}>{{ label }}</h2>
|
||||||
|
@ -36,9 +37,9 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="footer-promo-content">
|
<div class="footer-promo-content">
|
||||||
{% if not label %}
|
{% if not label %}
|
||||||
{{ content|without('field_title') }}
|
{{ content|without('field_title')|without('field_promo_image') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ content }}
|
{{ content|without('field_promo_image') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in New Issue