diff --git a/core/modules/node/config/optional/views.view.content_recent.yml b/core/modules/node/config/optional/views.view.content_recent.yml index 1d46cf51458d4a8a06ec524b51f033f9be8778ca..bae346309d10c371555248d128ce3f3eab3abdbe 100644 --- a/core/modules/node/config/optional/views.view.content_recent.yml +++ b/core/modules/node/config/optional/views.view.content_recent.yml @@ -50,54 +50,25 @@ display: items_per_page: 10 offset: 0 style: - type: table + type: html_list options: grouping: { } row_class: '' default_row_class: true - override: true - sticky: false - caption: '' - summary: '' - description: '' - columns: + type: ul + wrapper_class: item-list + class: '' + row: + type: fields + options: + default_field_elements: true + inline: title: title - name: title + name: name edit_node: edit_node delete_node: delete_node - info: - title: - sortable: false - default_sort_order: asc - align: '' - separator: '' - empty_column: false - responsive: '' - name: - sortable: false - default_sort_order: asc - align: '' - separator: '' - empty_column: false - responsive: '' - edit_node: - sortable: false - default_sort_order: asc - align: '' - separator: '' - empty_column: true - responsive: '' - delete_node: - sortable: false - default_sort_order: asc - align: '' - separator: '' - empty_column: true - responsive: '' - default: '-1' - empty_table: false - row: - type: fields + separator: ' ' + hide_empty: false fields: title: id: title @@ -144,7 +115,7 @@ display: relationship: uid group_type: group admin_label: '' - label: '' + label: 'by ' exclude: false alter: alter_text: false @@ -173,13 +144,13 @@ display: trim: false preserve_tags: '' html: false - element_type: div - element_class: '' + element_type: '' + element_class: byline element_label_type: '' element_label_class: '' element_label_colon: false element_wrapper_type: '' - element_wrapper_class: '' + element_wrapper_class: author element_default_classes: true empty: '' hide_empty: false @@ -188,57 +159,6 @@ display: entity_type: user entity_field: name plugin_id: field - type: user_name - edit_node: - id: edit_node - table: node - field: edit_node - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - text: Edit - entity_type: node plugin_id: entity_link_edit delete_node: id: delete_node diff --git a/core/modules/node/src/Tests/NodeBlockFunctionalTest.php b/core/modules/node/src/Tests/NodeBlockFunctionalTest.php index 13a835ad322324ccde8a774d43ab5927fd0b1681..0bcfbc143461133cac018487df8d9981e6a743a5 100644 --- a/core/modules/node/src/Tests/NodeBlockFunctionalTest.php +++ b/core/modules/node/src/Tests/NodeBlockFunctionalTest.php @@ -100,7 +100,7 @@ public function testRecentNodeBlock() { $this->assertText($node3->label(), 'Node found in block.'); // Check to make sure nodes are in the right order. - $this->assertTrue($this->xpath('//div[@id="block-test-block"]//table/tbody/tr[position() = 1]/td/a[text() = "' . $node3->label() . '"]'), 'Nodes were ordered correctly in block.'); + $this->assertTrue($this->xpath('//div[@id="block-test-block"]//div[@class="item-list"]/ul/li[1]/span[1]/span/a[text() = "' . $node3->label() . '"]'), 'Nodes were ordered correctly in block.'); $this->drupalLogout(); $this->drupalLogin($this->adminUser); diff --git a/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php b/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php index 31bfd3c93752cdf9a9a62cfbef48f4d75784e9e6..be8579566b1899014766a02082924628fa22e5d0 100644 --- a/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php +++ b/core/modules/views/src/Tests/Plugin/DisplayPageWebTest.php @@ -24,14 +24,14 @@ class DisplayPageWebTest extends PluginTestBase { * * @var array */ - public static $testViews = array('test_page_display', 'test_page_display_arguments', 'test_page_display_menu'); + public static $testViews = array('test_page_display', 'test_page_display_arguments', 'test_page_display_menu', 'test_page_display_path'); /** * Modules to enable. * * @var array */ - public static $modules = ['menu_ui', 'block']; + public static $modules = ['menu_ui', 'block', 'views_ui']; protected function setUp() { parent::setUp(); @@ -138,4 +138,36 @@ public function testTitleOutput() { $this->assertFalse($xpath, 'The view title was not displayed in the view markup.'); } + /** + * Tests the views page path functionality. + */ + public function testPagePaths() { + $this->drupalLogin($this->rootUser); + $this->assertPagePath('0'); + $this->assertPagePath('9999'); + } + + /** + * Tests that we can successfully change a view page display path. + * + * @param string $path + * Path that will be set as the view page display path. + * + * @return boolean + * Assertion result. + */ + public function assertPagePath($path) { + $view = Views::getView('test_page_display_path'); + $view->initDisplay('page_1'); + $view->displayHandlers->get('page_1')->overrideOption('path', $path); + $view->save(); + $this->container->get('router.builder')->rebuild(); + // Check if we successfully changed the path. + $this->drupalGet($path); + $success = $this->assertResponse(200); + // Check if we don't get any error on the view edit page. + $this->drupalGet('admin/structure/views/view/test_page_display_path'); + return $success && $this->assertResponse(200); + } + } diff --git a/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_path.yml b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_path.yml new file mode 100644 index 0000000000000000000000000000000000000000..c0530c4556e03986d8fa4b0b494ec6bb79bfd4a8 --- /dev/null +++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_page_display_path.yml @@ -0,0 +1,36 @@ +langcode: en +status: true +dependencies: { } +id: test_page_display_path +label: '' +module: views +description: '' +tag: '' +base_table: views_test_data +base_field: nid +core: '8' +display: + default: + display_options: + title: 'Test page display path' + defaults: + fields: false + pager: false + sorts: false + fields: + age: + field: age + id: age + relationship: none + table: views_test_data + plugin_id: numeric + display_plugin: default + display_title: Master + id: default + position: 0 + page_1: + display_options: + path: test_page_display_path + display_plugin: page + display_title: Page + id: page_1 diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php index d71d88866c962358fee5c4b354a1f2ec081966cc..8cd4e7b493dbf667421b28ad3f1d56b6fbd7f216 100644 --- a/core/modules/views_ui/src/ViewEditForm.php +++ b/core/modules/views_ui/src/ViewEditForm.php @@ -414,13 +414,20 @@ public function getDisplayDetails($view, $display) { elseif ($view->status() && $view->getExecutable()->displayHandlers->get($display['id'])->hasPath()) { $path = $view->getExecutable()->displayHandlers->get($display['id'])->getPath(); if ($path && (strpos($path, '%') === FALSE)) { + $uri = "base:$path"; + if (!parse_url($path, PHP_URL_SCHEME)) { + // @todo Views should expect and store a leading /. See: + // https://www.drupal.org/node/2423913 + $url = Url::fromUserInput('/' . ltrim($uri, '/')); + } + else { + $url = Url::fromUri($uri); + } $build['top']['actions']['path'] = array( '#type' => 'link', '#title' => $this->t('View !display_title', array('!display_title' => $display_title)), '#options' => array('alt' => array($this->t("Go to the real page for this display"))), - // @todo Use Url::fromPath() once - // https://www.drupal.org/node/2351379 is resolved. - '#url' => Url::fromUri("base:$path"), + '#url' => $url, '#prefix' => '<li class="view">', "#suffix" => '</li>', );