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 605d024..39141f4 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 @@ -114,8 +114,7 @@ public function optionsSummary(&$categories, &$options) { 'value' => views_ui_truncate($block_description, 24), ); - $allow = $this->getOption('allow'); - $filtered_allow = array_filter($allow); + $filtered_allow = array_filter($this->getOption('allow')); $options['allow'] = array( 'category' => 'block', diff --git a/core/modules/block/tests/lib/Drupal/block/Tests/Plugin/views/display/BlockTest.php b/core/modules/block/tests/lib/Drupal/block/Tests/Plugin/views/display/BlockTest.php index 6234851..1582160 100644 --- a/core/modules/block/tests/lib/Drupal/block/Tests/Plugin/views/display/BlockTest.php +++ b/core/modules/block/tests/lib/Drupal/block/Tests/Plugin/views/display/BlockTest.php @@ -19,14 +19,14 @@ class BlockTest extends UnitTestCase { /** * The view executable. * - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject */ protected $executable; /** * The views block plugin. * - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\views\Plugin\Block\ViewsBlock|\PHPUnit_Framework_MockObject_MockObject */ protected $blockPlugin; @@ -49,7 +49,7 @@ public static function getInfo() { * {@inheritdoc} */ protected function setUp() { - parent::setUp(); // TODO: Change the autogenerated stub + parent::setUp(); $this->executable = $this->getMockBuilder('Drupal\views\ViewExecutable') ->disableOriginalConstructor() @@ -73,7 +73,7 @@ protected function setUp() { } /** - * Test the build method with no overriding. + * Tests the build method with no overriding. */ public function testBuildNoOverride() { $this->executable->expects($this->never()) 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 c3fb441..c7b5c21 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php +++ b/core/modules/views/lib/Drupal/views/Plugin/Block/ViewsBlock.php @@ -63,6 +63,7 @@ public function __construct(array $configuration, $plugin_id, array $plugin_defi // Load the view. $view = $storage_controller->load($name); $this->view = $executable_factory->get($view); + $this->view->setDisplay($this->displayID); parent::__construct($configuration, $plugin_id, $plugin_definition); } @@ -121,17 +122,13 @@ public function build() { */ public function settings() { $settings = array(); - if ($this->view->setDisplay($this->displayID)) { - return $this->view->display_handler->blockSettings($settings); - } - return $settings; + return $this->view->display_handler->blockSettings($settings); } /** * {@inheritdoc} */ public function blockForm($form, &$form_state) { - $this->view->setDisplay($this->displayID); return $this->view->display_handler->blockForm($this, $form, $form_state); } @@ -139,7 +136,6 @@ public function blockForm($form, &$form_state) { * {@inheritdoc} */ public function blockValidate($form, &$form_state) { - $this->view->setDisplay($this->displayID); $this->view->display_handler->blockValidate($this, $form, $form_state); } @@ -147,7 +143,6 @@ public function blockValidate($form, &$form_state) { * {@inheritdoc} */ public function blockSubmit($form, &$form_state) { - $this->view->setDisplay($this->displayID); $this->view->display_handler->blockSubmit($this, $form, $form_state); } @@ -186,7 +181,6 @@ protected function addContextualLinks(&$output, $block_type = 'block') { * The new block instance ID. */ public function generateBlockInstanceID(EntityStorageControllerInterface $manager) { - $this->view->setDisplay($this->displayID); $original_id = 'views_block__' . $this->view->storage->id() . '_' . $this->view->current_display; // Get an array of block IDs without the theme prefix. 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 5257f67..1debfe8 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 @@ -32,28 +32,28 @@ class ViewsBlockTest extends UnitTestCase { /** * The view executable. * - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject */ protected $executable; /** * The view executable factory. * - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\views\ViewExecutableFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $executableFactory; /** * The view entity. * - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\views\ViewStorageInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $view; /** * The view storage controller. * - * @var \PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityStorageControllerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $storageController; @@ -107,7 +107,7 @@ protected function setUp() { } /** - * Test the build method. + * Tests the build method. * * @see \Drupal\views\Plugin\block\ViewsBlock::build() */ @@ -129,7 +129,7 @@ public function testBuild() { } /** - * Test the build method with a failed execution. + * Tests the build method with a failed execution. * * @see \Drupal\views\Plugin\block\ViewsBlock::build() */