Commit 0e758739 authored by xjm's avatar xjm

Issue #2829680 by tim.plunkett, andypost: BLOCK_LABEL_VISIBLE is defined on the wrong interface

parent d46fefcb
......@@ -2,7 +2,6 @@
namespace Drupal\Core\Block;
use Drupal\block\BlockInterface;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait;
......@@ -87,7 +86,7 @@ protected function baseConfigurationDefaults() {
'id' => $this->getPluginId(),
'label' => '',
'provider' => $this->pluginDefinition['provider'],
'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
'label_display' => static::BLOCK_LABEL_VISIBLE,
);
}
......@@ -172,8 +171,8 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
$form['label_display'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Display title'),
'#default_value' => ($this->configuration['label_display'] === BlockInterface::BLOCK_LABEL_VISIBLE),
'#return_value' => BlockInterface::BLOCK_LABEL_VISIBLE,
'#default_value' => ($this->configuration['label_display'] === static::BLOCK_LABEL_VISIBLE),
'#return_value' => static::BLOCK_LABEL_VISIBLE,
);
// Add context mapping UI form elements.
......
......@@ -22,6 +22,11 @@
*/
interface BlockPluginInterface extends ConfigurablePluginInterface, PluginFormInterface, PluginInspectionInterface, CacheableDependencyInterface, DerivativeInspectionInterface {
/**
* Indicates the block label (title) should be displayed to end users.
*/
const BLOCK_LABEL_VISIBLE = 'visible';
/**
* Returns the user-facing block label.
*
......
......@@ -2,6 +2,7 @@
namespace Drupal\block;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
/**
......@@ -11,8 +12,11 @@ interface BlockInterface extends ConfigEntityInterface {
/**
* Indicates the block label (title) should be displayed to end users.
*
* @deprecated in Drupal 8.3.x, will be removed before Drupal 9.0.0.
* Use \Drupal\Core\Block\BlockPluginInterface::BLOCK_LABEL_VISIBLE.
*/
const BLOCK_LABEL_VISIBLE = 'visible';
const BLOCK_LABEL_VISIBLE = BlockPluginInterface::BLOCK_LABEL_VISIBLE;
/**
* Denotes that a block is not enabled in any region and should not be shown.
......
......@@ -2,7 +2,7 @@
namespace Drupal\block\Plugin\migrate\process;
use Drupal\block\BlockInterface;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
......@@ -24,7 +24,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
$settings = array();
$settings['label'] = $title;
if ($title) {
$settings['label_display'] = BlockInterface::BLOCK_LABEL_VISIBLE;
$settings['label_display'] = BlockPluginInterface::BLOCK_LABEL_VISIBLE;
}
else {
$settings['label_display'] = '0';
......
......@@ -2,8 +2,8 @@
namespace Drupal\Tests\block\Kernel;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Form\FormState;
use Drupal\block\BlockInterface;
use Drupal\KernelTests\KernelTestBase;
/**
......@@ -38,7 +38,7 @@ public function testBlockInterface() {
'id' => 'test_block_instantiation',
'label' => 'Custom Display Message',
'provider' => 'block_test',
'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
'label_display' => BlockPluginInterface::BLOCK_LABEL_VISIBLE,
'display_message' => 'no message set',
);
// Initial configuration of the block at construction time.
......
......@@ -2,12 +2,12 @@
namespace Drupal\Tests\block\Kernel;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
use Drupal\KernelTests\KernelTestBase;
use Drupal\block_test\Plugin\Block\TestHtmlBlock;
use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\block\Entity\Block;
use Drupal\block\BlockInterface;
/**
* Tests the storage of blocks.
......@@ -95,7 +95,7 @@ protected function createTests() {
'id' => 'test_html',
'label' => '',
'provider' => 'block_test',
'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
'label_display' => BlockPluginInterface::BLOCK_LABEL_VISIBLE,
),
'visibility' => array(),
);
......
......@@ -6,11 +6,6 @@
use Drupal\Tests\UnitTestCase;
use Drupal\views\Plugin\Block\ViewsBlock;
// @todo Remove this once the constant got converted.
if (!defined('BLOCK_LABEL_VISIBLE')) {
define('BLOCK_LABEL_VISIBLE', 'visible');
}
/**
* @coversDefaultClass \Drupal\views\Plugin\block\ViewsBlock
* @group views
......
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