'More link' option should be configurable for views page displays

Created on 4 February 2012, almost 13 years ago
Updated 12 March 2024, 10 months ago

Using the 'More' link on a view displays of type "page" can only link to itself.

Steps to reproduce:

  1. Install Drupal and create some content
  2. Create a view with a page display
  3. In pager settings, enable the 'Create more link' option
  4. Actual result: The 'More' link is a link to the page display and there is no way to configure this - despite the description text for this field saying 'This will add a more link to the bottom of this view, which will link to the page view. If you have more than one page view, the link will point to the display specified in 'Link display' section under pager. You can override the URL at the link display setting.'
  5. Expected result: There should be a way to configure what the 'More' link is linking to, as suggested in the description text for the field.

Proposed resolution

Add a setting to configure what the 'More link' actually links to.
Arguments:

  • - like described in comments there are valid use cases when a "page" needs a "more link". #28 + #29: hardcode it makes it harder to translate the link text. So its not needed for a "page" to be different than "block"in this context.
  • - Hardcoded link could break if base URL changes or page display path is changed.
  • - Like stated in #35 the option "more link" is already there for pages, so why not leverage it?

Screenshots from patch #72

Before

After - showing new option

After - with a custom link


After - which display to use for path

Remaining tasks

Needs IS update
Needs tests
Review
Commit

User interface changes

Adds "Link display" settings when "more link" is enabled on "page" displays

Original report by geek.merlin aka axel.rutz

have a view with 2 pages and 2 blocks.

when configuring the more link, help text says:

This will add a more link to the bottom of this view, which will link to the page view. If you have more than one page view, the link will point to the display specified in 'Link display' above. You can override the url at the link display setting.

but i cannot find any " 'Link display' above" and both block more links point to the same page.

Feature request
Status

Needs work

Version

11.0 🔥

Component
Views 

Last updated about 2 hours ago

Created by

🇩🇪Germany geek-merlin Freiburg, Germany

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • Needs manual testing

    The change/bugfix cannot be fully demonstrated by automated testing, and thus requires manual testing in a variety of environments.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India nikhil_110

    Patch #88 applied successfully

  • Status changed to Needs work almost 2 years ago
  • 🇺🇸United States smustgrave

    Issue summary still needs updating per #80

    I didn't get same results as #80 but it's not working as expected.

    I tested using the Content view.
    If I set the more link to the page then it just redirects back to the page I'm on
    If I give it custom URL it's passing all the filter variables to it test?title=&type=All&status=All&langcode=All

    So don't think this is working correctly.

    Also shows the test coverage needs to be expanded.

  • Status changed to Needs review over 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    29,283 pass
  • 🇮🇳India mohit_aghera Rajkot

    Hi @smustgrave

    I tried to reproduce the issue and it seems to be working for me.

    If I set the more link to the page then it just redirects back to the page I'm on

    This is partially because of the confusing naming convention may be.
    When we are on the modal to select the more link page, it shows the name of view's display.
    You might have selected the same page i.e. "page" (option 3 in the following screenshot), which is same page.
    So link might be taking you to the same page.

    I have added another test case where we are linking a separate page (page_2) from page_1 view. This might clarify things further.
    Keeping the "needs tests" tag for now until we are sure that we have sufficient test coverage.

    If I give it a custom URL it's passing all the filter variables to it test?title=&type=All&status=All&langcode=All

    I think this change was introduced in http://drupal.org/node/564106. So probably this is by design.
    When we have any exposed form, view the exposed_raw_input from the current view and appends to more-link.
    Happy to have feedback from other forks about how we should proceed further.

  • Status changed to Needs work over 1 year ago
  • 🇳🇱Netherlands Lendude Amsterdam
    +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
    @@ -685,7 +685,7 @@ public function hasPath() {
       public function usesLinkDisplay() {
    -    return !$this->hasPath();
    +    return TRUE;
       }
    

    For an issue that wants to add this to Page displays, changing this in the base class sounds way too generic and might break BC for modules adding pathed displays that don't want this.

    Not totally sold on needing to support this in core, since looking at this, all you would need to do is add a new display plugin "Page with more link" that extends path but returns true for usesLinkDisplay(), pretty trivial, but ¯\_(ツ)_/¯

  • The Patch #94 'More link' option should be configurable for views page displays Needs work works for me on Drupal 10.2.3, php 8.1.2. Thanks.

  • 🇮🇳India sakthi_dev

    Rerolled the patch #94 with 11.x.

  • 🇮🇳India mohit_aghera Rajkot

    @sakthi_dev, I think patch is already getting applied on 11.x
    We probably don't need to re-roll the patch.
    Can you please upload the re-roll diff, if possible.

Production build 0.71.5 2024