diff --git a/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php b/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php index bb6b803..34a2a9a 100644 --- a/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php +++ b/core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php @@ -55,6 +55,13 @@ abstract class RelationshipPluginBase extends HandlerBase { /** + * The relationship alias. + * + * @var string + */ + public $alias; + + /** * Overrides \Drupal\views\Plugin\views\HandlerBase::init(). * * Init handler to let relationships live on tables other than diff --git a/core/modules/views/src/Tests/Handler/AreaTest.php b/core/modules/views/src/Tests/Handler/AreaTest.php index 1f72725..03b8b57 100644 --- a/core/modules/views/src/Tests/Handler/AreaTest.php +++ b/core/modules/views/src/Tests/Handler/AreaTest.php @@ -86,7 +86,7 @@ public function testUI() { /** * Tests the rendering of an area. */ - public function _testRenderArea() { + public function testRenderArea() { $view = Views::getView('test_example_area'); $view->initHandlers(); @@ -115,7 +115,7 @@ public function _testRenderArea() { /** * Tests the access for an area. */ - public function _testAreaAccess() { + public function testAreaAccess() { // Test with access denied for the area handler. $view = Views::getView('test_example_area_access'); $view->initDisplay(); @@ -154,7 +154,7 @@ public function _testAreaAccess() { /** * Tests global tokens. */ - public function _testRenderAreaToken() { + public function testRenderAreaToken() { $admin_user = $this->drupalCreateUser(array('administer views', 'administer site configuration')); $this->drupalLogin($admin_user); @@ -192,7 +192,7 @@ public function _testRenderAreaToken() { /** * Tests overriding the view title using the area title handler. */ - public function _testTitleArea() { + public function testTitleArea() { $view = Views::getView('frontpage'); $view->initDisplay('page_1'); diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index 781951b..7c3efa7 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -15,6 +15,7 @@ use Drupal\views\Plugin\views\query\QueryPluginBase; use Drupal\views\ViewEntityInterface; use Drupal\Component\Utility\Tags; +use Drupal\views_ui\ViewUI; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -2235,8 +2236,9 @@ public function calculateDependencies() { * {@inheritdoc} */ public function serialize() { + $storage = $this->storage instanceof ViewUI ? $this->storage : $this->storage->id(); return serialize([ - $this->storage->id(), + $storage, $this->current_display, $this->args, $this->current_page, @@ -2252,19 +2254,40 @@ public function serialize() { * {@inheritdoc} */ public function unserialize($serialized) { - list($storage_id, $current_display, $args, $current_page, $exposed_input, $exposed_raw_input, $exposed_data, $dom_id, $executed) = unserialize($serialized); + list($storage, $current_display, $args, $current_page, $exposed_input, $exposed_raw_input, $exposed_data, $dom_id, $executed) = unserialize($serialized); $this->setRequest(\Drupal::request()); $this->user = \Drupal::currentUser(); - $this->storage = \Drupal::entityManager()->getStorage('view')->load($storage_id); - $this->setDisplay($current_display); - $this->setArguments($args); - $this->setCurrentPage($current_page); - $this->setExposedInput($exposed_input); - $this->exposed_data = $exposed_data; - $this->exposed_raw_input = $exposed_raw_input; - $this->dom_id = $dom_id; + $this->storage = is_object($storage) ? $storage : \Drupal::entityManager()->getStorage('view')->load($storage); + + if ($current_display) { + $this->setDisplay($current_display); + } + + if ($args) { + $this->setArguments($args); + } + + if ($current_page) { + $this->setCurrentPage($current_page); + } + + if ($exposed_input) { + $this->setExposedInput($exposed_input); + } + + if ($exposed_data) { + $this->exposed_data = $exposed_data; + } + + if ($exposed_raw_input) { + $this->exposed_raw_input = $exposed_raw_input; + } + + if ($dom_id) { + $this->dom_id = $dom_id; + } $this->initHandlers(); diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index bfaad86..3b5351b 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -171,6 +171,7 @@ class ViewUI implements ViewEntityInterface { public function __construct(ViewEntityInterface $storage, ViewExecutable $executable = NULL) { $this->entityType = 'view'; $this->storage = $storage; + if (!isset($executable)) { $executable = Views::executableFactory()->get($this); } @@ -1128,7 +1129,7 @@ public static function postLoad(EntityStorageInterface $storage, array &$entitie * {@inheritdoc} */ public function getExecutable() { - return $this->storage->getExecutable(); + return $this->executable; } /**