Commit e29aaabd authored by alexpott's avatar alexpott
Browse files

Issue #2029677 by afeijo: Convert BLOCK_LABEL_VISIBLE to a constant on the block interface.

parent 9306022c
......@@ -43,10 +43,6 @@
*/
const BLOCK_VISIBILITY_PHP = 2;
/**
* Indicates the block label (title) should be displayed to end users.
*/
const BLOCK_LABEL_VISIBLE = 'visible';
/**
* Implements hook_help().
......
......@@ -8,6 +8,7 @@
namespace Drupal\block;
use Drupal\Component\Plugin\PluginBase;
use Drupal\block\BlockInterface;
/**
* Defines a base block implementation that most blocks plugins will extend.
......@@ -27,7 +28,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi
$this->configuration += $this->settings() + array(
'label' => '',
'module' => $plugin_definition['module'],
'label_display' => BLOCK_LABEL_VISIBLE,
'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
'cache' => DRUPAL_NO_CACHE,
);
}
......@@ -127,8 +128,8 @@ public function form($form, &$form_state) {
$form['label_display'] = array(
'#type' => 'checkbox',
'#title' => t('Display title'),
'#default_value' => $this->configuration['label_display'] == BLOCK_LABEL_VISIBLE,
'#return_value' => BLOCK_LABEL_VISIBLE,
'#default_value' => $this->configuration['label_display'] == BlockInterface::BLOCK_LABEL_VISIBLE,
'#return_value' => BlockInterface::BLOCK_LABEL_VISIBLE,
);
// Add plugin-specific settings for this block type.
......
......@@ -14,6 +14,11 @@
*/
interface BlockInterface extends ConfigEntityInterface {
/**
* Indicates the block label (title) should be displayed to end users.
*/
const BLOCK_LABEL_VISIBLE = 'visible';
/**
* Returns the plugin instance.
*
......
......@@ -8,6 +8,7 @@
namespace Drupal\block\Tests;
use Drupal\simpletest\DrupalUnitTestBase;
use Drupal\block\BlockInterface;
/**
* Test BlockInterface methods to ensure no external dependencies exist.
......@@ -46,7 +47,7 @@ public function testBlockInterface() {
'label' => 'Custom Display Message',
'display_message' => 'no message set',
'module' => 'block_test',
'label_display' => BLOCK_LABEL_VISIBLE,
'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
'cache' => DRUPAL_NO_CACHE,
);
// Initial configuration of the block at construction time.
......
......@@ -14,6 +14,7 @@
use Drupal\block\BlockStorageController;
use Drupal\Core\Entity\EntityMalformedException;
use Drupal\block\Plugin\Core\Entity\Block;
use Drupal\block\BlockInterface;
/**
* Tests the storage of blocks.
......@@ -103,7 +104,7 @@ protected function createTests() {
'cache' => '1',
'label' => '',
'module' => 'block_test',
'label_display' => BLOCK_LABEL_VISIBLE,
'label_display' => BlockInterface::BLOCK_LABEL_VISIBLE,
),
'visibility' => '',
);
......
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