Skip to content
Snippets Groups Projects
Commit 5c7c2617 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #3045812 by vadim.hirbu, Lendude, tedbow: Add display name to Views block placeholder

parent 1c299c6d
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -110,7 +110,12 @@ public function defaultConfiguration() {
* {@inheritdoc}
*/
public function getPreviewFallbackString() {
return $this->t('"@view" views block', ['@view' => $this->view->storage->label()]);
if (!empty($this->pluginDefinition["admin_label"])) {
return $this->t('"@view" views block', ['@view' => $this->pluginDefinition["admin_label"]]);
}
else {
return $this->t('"@view" views block', ['@view' => $this->view->storage->label() . '::' . $this->displayID]);
}
}
/**
......
......@@ -127,4 +127,19 @@ public function testBuildWithTitleOverride() {
$this->assertEquals('Overridden title', $build['#title']['#markup']);
}
/**
* Tests that ViewsBlock::getPreviewFallbackString() produces the right value.
*
* @see \Drupal\views\Plugin\Block\ViewsBlockBase::getPreviewFallbackString()
*/
public function testGetPreviewFallbackString() {
$plugin_definition = [
'provider' => 'views',
];
$plugin_id = 'views_block:test_view_block-block_1';
$views_block = ViewsBlock::create($this->container, [], $plugin_id, $plugin_definition);
$this->assertEqual($views_block->getPreviewFallbackString(), '"test_view_block::block_1" views block');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment