diff -u b/core/modules/block/block.module b/core/modules/block/block.module --- b/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -159,7 +159,7 @@ else { $id = $theme . '_' . $default_theme_block_id; } - $block = $default_theme_block->createDuplicate($id, $theme); + $block = $default_theme_block->createDuplicateBlock($id, $theme); // If the region isn't supported by the theme, assign the block to the // theme's default region. if (!isset($regions[$block->getRegion()])) { @@ -280,7 +280,7 @@ function block_menu_delete(Menu $menu) { if (!$menu->isSyncing()) { foreach (Block::loadMultiple() as $block) { - if ($block->get('plugin') == 'system_menu_block:' . $menu->id()) { + if ($block->getPlugin() == 'system_menu_block:' . $menu->id()) { $block->delete(); } } diff -u b/core/modules/block/src/BlockInterface.php b/core/modules/block/src/BlockInterface.php --- b/core/modules/block/src/BlockInterface.php +++ b/core/modules/block/src/BlockInterface.php @@ -143,2 +143,16 @@ + /** + * Creates a duplicate of the block entity. + * + * @param string $new_id + * (optional) The new ID on the duplicate block. + * @param string $new_theme + * (optional) The theme on the duplicate block. + * + * @return static + * A clone of $this with all identifiers unset, so saving it inserts a new + * entity into the storage system. + */ + public function createDuplicateBlock($new_id = NULL, $new_theme = NULL); + } diff -u b/core/modules/block/src/BlockListBuilder.php b/core/modules/block/src/BlockListBuilder.php --- b/core/modules/block/src/BlockListBuilder.php +++ b/core/modules/block/src/BlockListBuilder.php @@ -402,7 +402,7 @@ $entity_values = $form_state->getValue(array('blocks', $entity_id)); $entity->setWeight($entity_values['weight']); $entity->setRegion($entity_values['region']); - if ($entity->get('region') == BlockInterface::BLOCK_REGION_NONE) { + if ($entity->getRegion() == BlockInterface::BLOCK_REGION_NONE) { $entity->disable(); } else { diff -u b/core/modules/block/src/Entity/Block.php b/core/modules/block/src/Entity/Block.php --- b/core/modules/block/src/Entity/Block.php +++ b/core/modules/block/src/Entity/Block.php @@ -335,18 +335,9 @@ } /** - * Creates a duplicate of the entity. - * - * @param string $new_id - * (optional) The new ID on the duplicate block. - * @param string $new_theme - * (optional) The theme on the duplicate block. - * - * @return static - * A clone of $this with all identifiers unset, so saving it inserts a new - * entity into the storage system. + * {@inheritdoc} */ - public function createDuplicate($new_id = NULL, $new_theme = NULL) { + public function createDuplicateBlock($new_id = NULL, $new_theme = NULL) { $duplicate = parent::createDuplicate(); if (!empty($new_id)) { $duplicate->id = $new_id; only in patch2: unchanged: --- a/core/modules/block/src/BlockRepository.php +++ b/core/modules/block/src/BlockRepository.php @@ -78,7 +78,7 @@ public function getVisibleBlocksPerRegion(array $contexts) { /** @var \Drupal\block\BlockInterface $block */ // Set the contexts on the block before checking access. if ($block->setContexts($contexts)->access('view')) { - $full[$block->get('region')][$block_id] = $block; + $full[$block->getRegion()][$block_id] = $block; } } only in patch2: unchanged: --- a/core/modules/block/tests/src/Unit/BlockRepositoryTest.php +++ b/core/modules/block/tests/src/Unit/BlockRepositoryTest.php @@ -93,12 +93,8 @@ public function testGetVisibleBlocksPerRegion(array $blocks_config, array $expec ->method('access') ->will($this->returnValue($block_config[0])); $block->expects($block_config[0] ? $this->atLeastOnce() : $this->never()) - ->method('get') - ->will($this->returnValueMap(array( - array('region', $block_config[1]), - array('weight', $block_config[2]), - array('status', TRUE), - ))); + ->method('getRegion') + ->willReturn($block_config[1]); $blocks[$block_id] = $block; } @@ -159,8 +155,7 @@ public function testGetVisibleBlocksPerRegionWithContext() { ->method('access') ->willReturn(TRUE); $block->expects($this->once()) - ->method('get') - ->with('region') + ->method('getRegion') ->willReturn('top'); $blocks['block_id'] = $block; only in patch2: unchanged: --- a/core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php +++ b/core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php @@ -61,7 +61,7 @@ public function getFilterLabels() { * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { - $theme = $entity->get('theme'); + $theme = $entity->getTheme(); $plugin_definition = $entity->getPlugin()->getPluginDefinition(); $row['label'] = array(