diff --git a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php index a604bc9..8b36362 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php @@ -260,7 +260,7 @@ public function blockForm(ViewsBlock $block, array &$form, array &$form_state) { $block_configuration = $block->getConfig(); foreach ($allow_settings as $type => $enabled) { - if (!$enabled) { + if (empty($enabled)) { continue; } switch ($type) { diff --git a/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php b/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php index 554a53a..640628d 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php @@ -90,8 +90,6 @@ public function access() { * Overrides \Drupal\block\BlockBase::form(). */ public function form($form, &$form_state) { - $form = parent::form($form, $form_state); - // Set the default label to '' so the views internal title is used. $form['label']['#default_value'] = ''; $form['label']['#access'] = FALSE; @@ -109,10 +107,10 @@ public function build() { } if ($config['more_link'] === 0) { - $this->view->display_handler->setOption('use_more', TRUE); + $this->view->display_handler->setOption('use_more', FALSE); } elseif ($config['more_link'] === 1) { - $this->view->display_handler->setOption('use_more', FALSE); + $this->view->display_handler->setOption('use_more', TRUE); } if ($output = $this->view->executeDisplay($this->displayID)) { @@ -131,8 +129,7 @@ public function build() { * {@inheritdoc} */ public function settings() { - $settings = parent::settings(); - + $settings = array(); $this->view->setDisplay($this->displayID); return $this->view->display_handler->blockSettings($settings); } @@ -141,8 +138,6 @@ public function settings() { * {@inheritdoc} */ public function blockForm($form, &$form_state) { - parent::blockForm($form, $form_state); - $this->view->setDisplay($this->displayID); return $this->view->display_handler->blockForm($this, $form, $form_state); } @@ -151,8 +146,6 @@ public function blockForm($form, &$form_state) { * {@inheritdoc} */ public function blockValidate($form, &$form_state) { - parent::blockValidate($form, $form_state); - $this->view->setDisplay($this->displayID); $this->view->display_handler->blockValidate($this, $form, $form_state); } @@ -161,8 +154,6 @@ public function blockValidate($form, &$form_state) { * {@inheritdoc} */ public function blockSubmit($form, &$form_state) { - parent::blockSubmit($form, $form_state); - $this->view->setDisplay($this->displayID); $this->view->display_handler->blockSubmit($this, $form, $form_state); } diff --git a/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php b/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php index 1f9dac3..f601521 100644 --- a/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php +++ b/core/modules/views/tests/Drupal/views/Tests/Plugin/Block/ViewsBlockTest.php @@ -73,7 +73,7 @@ protected function setUp() { $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable') ->disableOriginalConstructor() - ->setMethods(array('executeDisplay', 'setDisplay', 'destroy')) + ->setMethods(array('executeDisplay', 'setDisplay')) ->getMock(); $this->executable->display_handler = $this->getMockBuilder('Drupal\block\Plugin\views\display\Block') @@ -91,7 +91,7 @@ protected function setUp() { ->getMock(); $this->executableFactory->staticExpects($this->any()) ->method('get') - ->with($this->equalTo($this->view)) + ->with($this->view) ->will($this->returnValue($this->executable)); $this->storageController = $this->getMockBuilder('Drupal\views\ViewStorageController') @@ -100,7 +100,7 @@ protected function setUp() { $this->storageController->expects($this->any()) ->method('load') - ->with($this->equalTo(array('test_view'))) + ->with(array('test_view')) ->will($this->returnValue(array($this->view))); } @@ -116,14 +116,6 @@ public function testBuild() { ->method('executeDisplay') ->with($this->equalTo('block_1')) ->will($this->returnValue($build)); - $this->executable->expects($this->once()) - ->method('destroy') - ->will($this->returnValue(TRUE)); - - $this->executable->expects($this->once()) - ->method('destroy') - ->with() - ->will($this->returnValue(TRUE)); $block_id = 'views_block:test_view-block_1'; $config = array(); @@ -146,11 +138,6 @@ public function testBuildFailed() { ->with($this->equalTo('block_1')) ->will($this->returnValue($output)); - $this->executable->expects($this->never()) - ->method('destroy') - ->with() - ->will($this->returnValue(TRUE)); - $block_id = 'views_block:test_view-block_1'; $config = array(); $definition = array(); @@ -164,9 +151,9 @@ public function testBuildFailed() { * Test the build method with no overriding. */ public function testBuildNoOverride() { - $this->view->expects($this->never()) + $this->executable->expects($this->never()) ->method('setItemsPerPage'); - $this->view->display_handler->expects($this->never()) + $this->executable->display_handler->expects($this->never()) ->method('setOption'); $block_id = 'views_block:test_view-block_1'; @@ -182,12 +169,12 @@ public function testBuildNoOverride() { * Tests the build method with overriding items per page and the more link. */ public function testBuildOverride() { - $this->view->expects($this->once()) + $this->executable->expects($this->once()) ->method('setItemsPerPage') - ->with($this->equalTo(5)); - $this->view->display_handler->expects($this->once()) + ->with(5); + $this->executable->display_handler->expects($this->once()) ->method('setOption') - ->with($this->equalTo(array('use_more', TRUE))); + ->with('use_more', TRUE); $block_id = 'views_block:test_view-block_1'; $config = array('items_per_page' => 5, 'more_link' => 1);