diff --git a/core/modules/action/tests/Drupal/action/Tests/Menu/ActionLocalTasksTest.php b/core/modules/action/tests/Drupal/action/Tests/Menu/ActionLocalTasksTest.php
index 891db5bb868a..729d3141e4ac 100644
--- a/core/modules/action/tests/Drupal/action/Tests/Menu/ActionLocalTasksTest.php
+++ b/core/modules/action/tests/Drupal/action/Tests/Menu/ActionLocalTasksTest.php
@@ -26,7 +26,7 @@ class ActionLocalTasksTest extends LocalTaskIntegrationTest {
}
public function setUp() {
- $this->moduleList = array('action' => 'core/modules/action/action.info.yml');
+ $this->moduleList = array('action' => 'core/modules/action/action.module');
parent::setUp();
}
diff --git a/core/modules/aggregator/tests/Drupal/aggregator/Tests/Menu/AggregatorLocalTasksTest.php b/core/modules/aggregator/tests/Drupal/aggregator/Tests/Menu/AggregatorLocalTasksTest.php
index 67bedd87cfa1..511960331ff2 100644
--- a/core/modules/aggregator/tests/Drupal/aggregator/Tests/Menu/AggregatorLocalTasksTest.php
+++ b/core/modules/aggregator/tests/Drupal/aggregator/Tests/Menu/AggregatorLocalTasksTest.php
@@ -26,7 +26,7 @@ class AggregatorLocalTasksTest extends LocalTaskIntegrationTest {
}
public function setUp() {
- $this->moduleList = array('aggregator' => 'core/modules/aggregator/aggregator.info.yml');
+ $this->moduleList = array('aggregator' => 'core/modules/aggregator/aggregator.module');
parent::setUp();
}
diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index 4d9643088657..e27af492ac1e 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -5,15 +5,11 @@
* Controls the visual building blocks a page is constructed with.
*/
+use Drupal\block\BlockInterface;
use Drupal\Component\Plugin\Exception\PluginException;
use Drupal\Component\Utility\NestedArray;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
-/**
- * Denotes that a block is not enabled in any region and should not be shown.
- */
-const BLOCK_REGION_NONE = -1;
-
/**
* Shows this block on every page except the listed pages.
*/
@@ -308,15 +304,15 @@ function _block_rehash($theme = NULL) {
$region = $block->get('region');
$status = $block->status();
// Disable blocks in invalid regions.
- if (!empty($region) && $region != BLOCK_REGION_NONE && !isset($regions[$region]) && $status) {
+ if (!empty($region) && $region != BlockInterface::BLOCK_REGION_NONE && !isset($regions[$region]) && $status) {
drupal_set_message(t('The block %info was assigned to the invalid region %region and has been disabled.', array('%info' => $block_id, '%region' => $region)), 'warning');
- // Disabled modules are moved into the BLOCK_REGION_NONE later so no
- // need to move the block to another region.
+ // Disabled modules are moved into the BlockInterface::BLOCK_REGION_NONE
+ // later so no need to move the block to another region.
$block->disable()->save();
}
// Set region to none if not enabled.
if (!$status) {
- $block->set('region', BLOCK_REGION_NONE);
+ $block->set('region', BlockInterface::BLOCK_REGION_NONE);
$block->save();
}
}
diff --git a/core/modules/block/custom_block/tests/Drupal/custom_blocks/Tests/Menu/CustomBlockLocalTasksTest.php b/core/modules/block/custom_block/tests/Drupal/custom_blocks/Tests/Menu/CustomBlockLocalTasksTest.php
index 96866fd4efbf..39ddc5479b76 100644
--- a/core/modules/block/custom_block/tests/Drupal/custom_blocks/Tests/Menu/CustomBlockLocalTasksTest.php
+++ b/core/modules/block/custom_block/tests/Drupal/custom_blocks/Tests/Menu/CustomBlockLocalTasksTest.php
@@ -27,8 +27,8 @@ class CustomBlockLocalTasksTest extends LocalTaskIntegrationTest {
public function setUp() {
$this->moduleList = array(
- 'block' => 'core/modules/block/block.info.yml',
- 'custom_block' => 'core/modules/block/custom_block/custom_block.info.yml',
+ 'block' => 'core/modules/block/block.module',
+ 'custom_block' => 'core/modules/block/custom_block/custom_block.module',
);
parent::setUp();
}
diff --git a/core/modules/block/lib/Drupal/block/BlockFormController.php b/core/modules/block/lib/Drupal/block/BlockFormController.php
index 92d369664375..e2692a406cb6 100644
--- a/core/modules/block/lib/Drupal/block/BlockFormController.php
+++ b/core/modules/block/lib/Drupal/block/BlockFormController.php
@@ -259,7 +259,7 @@ class BlockFormController extends EntityFormController {
'#title' => $this->t('Region'),
'#description' => $this->t('Select the region where this block should be displayed.'),
'#default_value' => $entity->get('region'),
- '#empty_value' => BLOCK_REGION_NONE,
+ '#empty_value' => BlockInterface::BLOCK_REGION_NONE,
'#options' => system_region_list($theme, REGIONS_VISIBLE),
'#prefix' => '
',
'#suffix' => '
',
diff --git a/core/modules/block/lib/Drupal/block/BlockInterface.php b/core/modules/block/lib/Drupal/block/BlockInterface.php
index 0ffbcfcd7994..de0d9de6f415 100644
--- a/core/modules/block/lib/Drupal/block/BlockInterface.php
+++ b/core/modules/block/lib/Drupal/block/BlockInterface.php
@@ -19,6 +19,11 @@ interface BlockInterface extends ConfigEntityInterface {
*/
const BLOCK_LABEL_VISIBLE = 'visible';
+ /**
+ * Denotes that a block is not enabled in any region and should not be shown.
+ */
+ const BLOCK_REGION_NONE = -1;
+
/**
* Returns the plugin instance.
*
diff --git a/core/modules/block/lib/Drupal/block/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php
index 30d0afd633ea..874ff35b8fdf 100644
--- a/core/modules/block/lib/Drupal/block/BlockListController.php
+++ b/core/modules/block/lib/Drupal/block/BlockListController.php
@@ -155,7 +155,7 @@ class BlockListController extends ConfigEntityListController implements FormInte
$form['#attributes']['class'][] = 'clearfix';
// Add a last region for disabled blocks.
- $block_regions_with_disabled = $this->regions + array(BLOCK_REGION_NONE => BLOCK_REGION_NONE);
+ $block_regions_with_disabled = $this->regions + array(BlockInterface::BLOCK_REGION_NONE => BlockInterface::BLOCK_REGION_NONE);
$form['block_regions'] = array(
'#type' => 'value',
'#value' => $block_regions_with_disabled,
@@ -219,7 +219,7 @@ class BlockListController extends ConfigEntityListController implements FormInte
),
);
$form['blocks'][$region]['title'] = array(
- '#markup' => $region != BLOCK_REGION_NONE ? $title : t('Disabled'),
+ '#markup' => $region != BlockInterface::BLOCK_REGION_NONE ? $title : t('Disabled'),
'#wrapper_attributes' => array(
'colspan' => 5,
),
@@ -263,7 +263,7 @@ class BlockListController extends ConfigEntityListController implements FormInte
$form['blocks'][$entity_id]['region-theme']['region'] = array(
'#type' => 'select',
'#default_value' => $region,
- '#empty_value' => BLOCK_REGION_NONE,
+ '#empty_value' => BlockInterface::BLOCK_REGION_NONE,
'#title' => t('Region for @block block', array('@block' => $info['admin_label'])),
'#title_display' => 'invisible',
'#options' => $this->regions,
@@ -404,7 +404,7 @@ class BlockListController extends ConfigEntityListController implements FormInte
foreach ($entities as $entity_id => $entity) {
$entity->set('weight', $form_state['values']['blocks'][$entity_id]['weight']);
$entity->set('region', $form_state['values']['blocks'][$entity_id]['region']);
- if ($entity->get('region') == BLOCK_REGION_NONE) {
+ if ($entity->get('region') == BlockInterface::BLOCK_REGION_NONE) {
$entity->disable();
}
else {
diff --git a/core/modules/block/lib/Drupal/block/Entity/Block.php b/core/modules/block/lib/Drupal/block/Entity/Block.php
index 67d10e410086..020b97054840 100644
--- a/core/modules/block/lib/Drupal/block/Entity/Block.php
+++ b/core/modules/block/lib/Drupal/block/Entity/Block.php
@@ -71,7 +71,7 @@ class Block extends ConfigEntityBase implements BlockInterface {
*
* @var string
*/
- protected $region = BLOCK_REGION_NONE;
+ protected $region = self::BLOCK_REGION_NONE;
/**
* The block weight.
@@ -163,7 +163,7 @@ class Block extends ConfigEntityBase implements BlockInterface {
return $status;
}
// Sort by weight, unless disabled.
- if ($a->get('region') != BLOCK_REGION_NONE) {
+ if ($a->get('region') != static::BLOCK_REGION_NONE) {
$weight = $a->get('weight') - $b->get('weight');
if ($weight) {
return $weight;
diff --git a/core/modules/block/tests/Drupal/block/Tests/BlockFormControllerTest.php b/core/modules/block/tests/Drupal/block/Tests/BlockFormControllerTest.php
index e01c9f129890..8394d031a17d 100644
--- a/core/modules/block/tests/Drupal/block/Tests/BlockFormControllerTest.php
+++ b/core/modules/block/tests/Drupal/block/Tests/BlockFormControllerTest.php
@@ -10,11 +10,6 @@ namespace Drupal\Tests\block;
use Drupal\block\BlockFormController;
use Drupal\Tests\UnitTestCase;
-// @todo Remove once the constants are replaced with constants on classes.
-if (!defined('BLOCK_REGION_NONE')) {
- define('BLOCK_REGION_NONE', -1);
-}
-
/**
* Tests the block form controller.
*
diff --git a/core/modules/block/tests/Drupal/block/Tests/Menu/BlockLocalTasksTest.php b/core/modules/block/tests/Drupal/block/Tests/Menu/BlockLocalTasksTest.php
index 59b26f89488b..989a7ecd3dcc 100644
--- a/core/modules/block/tests/Drupal/block/Tests/Menu/BlockLocalTasksTest.php
+++ b/core/modules/block/tests/Drupal/block/Tests/Menu/BlockLocalTasksTest.php
@@ -26,7 +26,7 @@ class BlockLocalTasksTest extends LocalTaskIntegrationTest {
}
public function setUp() {
- $this->moduleList = array('block' => 'core/modules/block/block.info.yml');
+ $this->moduleList = array('block' => 'core/modules/block/block.module');
parent::setUp();
$config_factory = $this->getConfigFactoryStub(array('system.theme' => array(
diff --git a/core/modules/book/tests/Drupal/book/Tests/Menu/BookLocalTasksTest.php b/core/modules/book/tests/Drupal/book/Tests/Menu/BookLocalTasksTest.php
index 2f8d7491611f..c1f14343131b 100644
--- a/core/modules/book/tests/Drupal/book/Tests/Menu/BookLocalTasksTest.php
+++ b/core/modules/book/tests/Drupal/book/Tests/Menu/BookLocalTasksTest.php
@@ -27,8 +27,8 @@ class BookLocalTasksTest extends LocalTaskIntegrationTest {
public function setUp() {
$this->moduleList = array(
- 'book' => 'core/modules/book/book.info.yml',
- 'node' => 'core/modules/node/node.info.yml',
+ 'book' => 'core/modules/book/book.module',
+ 'node' => 'core/modules/node/node.module',
);
parent::setUp();
}
diff --git a/core/modules/config/tests/Drupal/config/Tests/Menu/ConfigLocalTasksTest.php b/core/modules/config/tests/Drupal/config/Tests/Menu/ConfigLocalTasksTest.php
index ad00f103ffab..43640c59f69c 100644
--- a/core/modules/config/tests/Drupal/config/Tests/Menu/ConfigLocalTasksTest.php
+++ b/core/modules/config/tests/Drupal/config/Tests/Menu/ConfigLocalTasksTest.php
@@ -26,7 +26,7 @@ class ConfigLocalTasksTest extends LocalTaskIntegrationTest {
}
public function setUp() {
- $this->moduleList = array('config' => 'core/modules/config/config.info.yml');
+ $this->moduleList = array('config' => 'core/modules/config/config.module');
parent::setUp();
}
diff --git a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php
index 558bdfdac8a0..f87ff77aa686 100644
--- a/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php
+++ b/core/modules/content_translation/lib/Drupal/content_translation/Plugin/Derivative/ContentTranslationLocalTasks.php
@@ -120,15 +120,15 @@ class ContentTranslationLocalTasks extends DerivativeBase implements ContainerDe
* Returns the local task ID of the parent task, otherwise return FALSE.
*/
protected function getTaskFromRoute($route_name, &$local_tasks) {
- $local_task = FALSE;
+ $parent_local_task = FALSE;
foreach ($local_tasks as $plugin_id => $local_task) {
if ($local_task['route_name'] == $route_name) {
- $local_task = $plugin_id;
+ $parent_local_task = $plugin_id;
break;
}
}
- return $local_task;
+ return $parent_local_task;
}
/**
diff --git a/core/modules/content_translation/tests/Drupal/content_translation/Tests/Menu/ContentTranslationLocalTasksTest.php b/core/modules/content_translation/tests/Drupal/content_translation/Tests/Menu/ContentTranslationLocalTasksTest.php
index cde6985a964f..7b0c1c035a46 100644
--- a/core/modules/content_translation/tests/Drupal/content_translation/Tests/Menu/ContentTranslationLocalTasksTest.php
+++ b/core/modules/content_translation/tests/Drupal/content_translation/Tests/Menu/ContentTranslationLocalTasksTest.php
@@ -27,8 +27,8 @@ class ContentTranslationLocalTasksTest extends LocalTaskIntegrationTest {
public function setUp() {
$this->moduleList = array(
- 'content_translation' => 'core/modules/content_translation/content_translation.info.yml',
- 'node' => 'core/modules/node/node.info.yml',
+ 'content_translation' => 'core/modules/content_translation/content_translation.module',
+ 'node' => 'core/modules/node/node.module',
);
parent::setUp();
diff --git a/core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php b/core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php
index 36ea4697d017..cd3cd2f96eb6 100644
--- a/core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php
+++ b/core/modules/language/tests/Drupal/language/Tests/Menu/LanguageLocalTasks.php
@@ -27,7 +27,7 @@ class LanguageLocalTasks extends LocalTaskIntegrationTest {
public function setUp() {
$this->moduleList = array(
- 'language' => 'core/modules/language/language.info.yml',
+ 'language' => 'core/modules/language/language.module',
);
parent::setUp();
}
diff --git a/core/modules/locale/tests/Drupal/locale/Tests/Menu/LocaleLocalTasksTest.php b/core/modules/locale/tests/Drupal/locale/Tests/Menu/LocaleLocalTasksTest.php
index 4c188318fbf6..f8db54fcb1f9 100644
--- a/core/modules/locale/tests/Drupal/locale/Tests/Menu/LocaleLocalTasksTest.php
+++ b/core/modules/locale/tests/Drupal/locale/Tests/Menu/LocaleLocalTasksTest.php
@@ -27,7 +27,7 @@ class LocaleLocalTasksTest extends LocalTaskIntegrationTest {
public function setUp() {
$this->moduleList = array(
- 'locale' => 'core/modules/locale/locale.info.yml',
+ 'locale' => 'core/modules/locale/locale.module',
);
parent::setUp();
}
diff --git a/core/modules/shortcut/tests/Drupal/shortcut/Tests/Menu/ShortcutLocalTasksTest.php b/core/modules/shortcut/tests/Drupal/shortcut/Tests/Menu/ShortcutLocalTasksTest.php
index ff8bd7efdb72..edc5e8b6e456 100644
--- a/core/modules/shortcut/tests/Drupal/shortcut/Tests/Menu/ShortcutLocalTasksTest.php
+++ b/core/modules/shortcut/tests/Drupal/shortcut/Tests/Menu/ShortcutLocalTasksTest.php
@@ -27,8 +27,8 @@ class ShortcutLocalTasksTest extends LocalTaskIntegrationTest {
public function setUp() {
$this->moduleList = array(
- 'shortcut' => 'core/modules/shortcut/shortcut.info.yml',
- 'user' => 'core/modules/user/user.info.yml',
+ 'shortcut' => 'core/modules/shortcut/shortcut.module',
+ 'user' => 'core/modules/user/user.module',
);
parent::setUp();
}
diff --git a/core/modules/taxonomy/tests/Drupal/taxonomy/Tests/Menu/TaxonomyLocalTasksTest.php b/core/modules/taxonomy/tests/Drupal/taxonomy/Tests/Menu/TaxonomyLocalTasksTest.php
index 6151cb26abbe..52708a452a9e 100644
--- a/core/modules/taxonomy/tests/Drupal/taxonomy/Tests/Menu/TaxonomyLocalTasksTest.php
+++ b/core/modules/taxonomy/tests/Drupal/taxonomy/Tests/Menu/TaxonomyLocalTasksTest.php
@@ -26,7 +26,7 @@ class TaxonomyLocalTasksTest extends LocalTaskIntegrationTest {
}
public function setUp() {
- $this->moduleList = array('taxonomy' => 'core/modules/taxonomy/taxonomy.info.yml');
+ $this->moduleList = array('taxonomy' => 'core/modules/taxonomy/taxonomy.module');
parent::setUp();
}
diff --git a/core/modules/user/tests/Drupal/user/Tests/Menu/UserLocalTasksTest.php b/core/modules/user/tests/Drupal/user/Tests/Menu/UserLocalTasksTest.php
index a978178f2d3e..5fb9f40a5a79 100644
--- a/core/modules/user/tests/Drupal/user/Tests/Menu/UserLocalTasksTest.php
+++ b/core/modules/user/tests/Drupal/user/Tests/Menu/UserLocalTasksTest.php
@@ -26,7 +26,7 @@ class UserLocalTasksTest extends LocalTaskIntegrationTest {
}
public function setUp() {
- $this->moduleList = array('user' => 'core/modules/user/user.info.yml');
+ $this->moduleList = array('user' => 'core/modules/user/user.module');
parent::setUp();
}