Commit cf3d7797 authored by alexpott's avatar alexpott

Issue #3042216 by johndevman, lauriii, tim.plunkett: Only add...

Issue #3042216 by johndevman, lauriii, tim.plunkett: Only add .layout-builder-block to blocks when in the Layout Builder UI
parent 508a63e7
......@@ -247,6 +247,7 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s
if (!empty($build[$region])) {
foreach (Element::children($build[$region]) as $uuid) {
$build[$region][$uuid]['#attributes']['class'][] = 'draggable';
$build[$region][$uuid]['#attributes']['class'][] = 'layout-builder-block';
$build[$region][$uuid]['#attributes']['data-layout-block-uuid'] = $uuid;
$build[$region][$uuid]['#attributes']['data-layout-builder-highlight-id'] = $this->blockUpdateHighlightId($uuid);
$build[$region][$uuid]['#contextual_links'] = [
......
......@@ -117,7 +117,6 @@ public function onBuildRender(SectionComponentBuildRenderArrayEvent $event) {
'#base_plugin_id' => $block->getBaseId(),
'#derivative_plugin_id' => $block->getDerivativeId(),
'#weight' => $event->getComponent()->getWeight(),
'#attributes' => ['class' => ['layout-builder-block']],
'content' => $content,
];
......
......@@ -225,6 +225,7 @@ public function testLayoutBuilderUi() {
]));
$this->drupalGet('node/1');
$assert_session->elementNotExists('css', '.layout-builder-block');
$assert_session->pageTextContains('The first node body');
$assert_session->pageTextNotContains('Powered by Drupal');
$assert_session->linkNotExists('Layout');
......@@ -245,6 +246,8 @@ public function testLayoutBuilderUi() {
$assert_session->elementsCount('css', '.field--name-body', 1);
// The extra field is only present once.
$assert_session->pageTextContainsOnce('Placeholder for the "Extra label" field');
// Blocks have layout builder specific block class.
$assert_session->elementExists('css', '.layout-builder-block');
// Save the defaults.
$page->pressButton('Save layout');
$assert_session->addressEquals("$field_ui_prefix/display/default");
......
......@@ -119,7 +119,6 @@ public function testOnBuildRender($refinable_dependent_access) {
'content' => $block_content,
'#attributes' => [
'data-layout-content-preview-placeholder-label' => $placeholder_label,
'class' => ['layout-builder-block'],
],
];
......@@ -195,7 +194,6 @@ public function testOnBuildRenderWithoutPreviewFallbackString($refinable_depende
'content' => $block_content,
'#attributes' => [
'data-layout-content-preview-placeholder-label' => $placeholder_label,
'class' => ['layout-builder-block'],
],
];
......@@ -325,7 +323,6 @@ public function testOnBuildRenderInPreview($refinable_dependent_access) {
'content' => $block_content,
'#attributes' => [
'data-layout-content-preview-placeholder-label' => $placeholder_label,
'class' => ['layout-builder-block'],
],
];
......@@ -385,7 +382,6 @@ public function testOnBuildRenderInPreviewEmptyBuild() {
'content' => $block_content,
'#attributes' => [
'data-layout-content-preview-placeholder-label' => $placeholder_string,
'class' => ['layout-builder-block'],
],
];
$expected_build['content']['#markup'] = $placeholder_string;
......
......@@ -112,7 +112,6 @@ public function testToRenderArray() {
'content' => $block_content,
'#attributes' => [
'data-layout-content-preview-placeholder-label' => $placeholder_label,
'class' => ['layout-builder-block'],
],
'#cache' => [
'contexts' => [],
......@@ -196,7 +195,6 @@ public function testToRenderArrayPreview() {
'content' => $block_content,
'#attributes' => [
'data-layout-content-preview-placeholder-label' => $placeholder_label,
'class' => ['layout-builder-block'],
],
'#cache' => [
'contexts' => [],
......@@ -256,7 +254,6 @@ public function testContextAwareBlock() {
'content' => $block_content,
'#attributes' => [
'data-layout-content-preview-placeholder-label' => $placeholder_label,
'class' => ['layout-builder-block'],
],
'#cache' => [
'contexts' => [],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment