Issue #3090174 by tim.plunkett, henriklarsson: Data attribute 'layout-content-preview-placeholder-label' exists outside LB UI
parent
bd584c5719
commit
a22c3c4580
|
@ -120,20 +120,23 @@ class BlockComponentRenderArray implements EventSubscriberInterface {
|
|||
'content' => $content,
|
||||
];
|
||||
|
||||
if ($block instanceof PreviewFallbackInterface) {
|
||||
$preview_fallback_string = $block->getPreviewFallbackString();
|
||||
}
|
||||
else {
|
||||
$preview_fallback_string = $this->t('"@block" block', ['@block' => $block->label()]);
|
||||
}
|
||||
// @todo Use new label methods so
|
||||
// data-layout-content-preview-placeholder-label doesn't have to use
|
||||
// preview fallback in https://www.drupal.org/node/2025649.
|
||||
$build['#attributes']['data-layout-content-preview-placeholder-label'] = $preview_fallback_string;
|
||||
if ($event->inPreview()) {
|
||||
if ($block instanceof PreviewFallbackInterface) {
|
||||
$preview_fallback_string = $block->getPreviewFallbackString();
|
||||
}
|
||||
else {
|
||||
$preview_fallback_string = $this->t('"@block" block', ['@block' => $block->label()]);
|
||||
}
|
||||
// @todo Use new label methods so
|
||||
// data-layout-content-preview-placeholder-label doesn't have to use
|
||||
// preview fallback in https://www.drupal.org/node/2025649.
|
||||
$build['#attributes']['data-layout-content-preview-placeholder-label'] = $preview_fallback_string;
|
||||
|
||||
if ($is_content_empty && $is_placeholder_ready) {
|
||||
$build['content']['#markup'] = $this->t('Placeholder for the @preview_fallback', ['@preview_fallback' => $block->getPreviewFallbackString()]);
|
||||
if ($is_content_empty && $is_placeholder_ready) {
|
||||
$build['content']['#markup'] = $this->t('Placeholder for the @preview_fallback', ['@preview_fallback' => $block->getPreviewFallbackString()]);
|
||||
}
|
||||
}
|
||||
|
||||
$event->setBuild($build);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,9 +117,6 @@ class BlockComponentRenderArrayTest extends UnitTestCase {
|
|||
'#base_plugin_id' => 'block_plugin_id',
|
||||
'#derivative_plugin_id' => NULL,
|
||||
'content' => $block_content,
|
||||
'#attributes' => [
|
||||
'data-layout-content-preview-placeholder-label' => $placeholder_label,
|
||||
],
|
||||
];
|
||||
|
||||
$expected_cache = $expected_build + [
|
||||
|
@ -192,9 +189,6 @@ class BlockComponentRenderArrayTest extends UnitTestCase {
|
|||
'#base_plugin_id' => 'block_plugin_id',
|
||||
'#derivative_plugin_id' => NULL,
|
||||
'content' => $block_content,
|
||||
'#attributes' => [
|
||||
'data-layout-content-preview-placeholder-label' => $placeholder_label,
|
||||
],
|
||||
];
|
||||
|
||||
$expected_cache = $expected_build + [
|
||||
|
|
|
@ -110,9 +110,6 @@ class SectionRenderTest extends UnitTestCase {
|
|||
'#base_plugin_id' => 'block_plugin_id',
|
||||
'#derivative_plugin_id' => NULL,
|
||||
'content' => $block_content,
|
||||
'#attributes' => [
|
||||
'data-layout-content-preview-placeholder-label' => $placeholder_label,
|
||||
],
|
||||
'#cache' => [
|
||||
'contexts' => [],
|
||||
'tags' => [],
|
||||
|
@ -252,9 +249,6 @@ class SectionRenderTest extends UnitTestCase {
|
|||
'#base_plugin_id' => 'block_plugin_id',
|
||||
'#derivative_plugin_id' => NULL,
|
||||
'content' => $block_content,
|
||||
'#attributes' => [
|
||||
'data-layout-content-preview-placeholder-label' => $placeholder_label,
|
||||
],
|
||||
'#cache' => [
|
||||
'contexts' => [],
|
||||
'tags' => [],
|
||||
|
|
Loading…
Reference in New Issue