Problem/Motivation

The link_url field allow to set a custom URL for the views more link. As it is a default textfield, its default maxlength is 128 chars. This field allow to use some tokens if the view is using one or more parameters so its content can be longer than 128 characters.
The configuration can hold a lot more (no limit) so a workaround is to write the final value in the YML file then import it but it's not robust enough.

Proposed resolution

Steps to reproduce

  1. Install Drupal 11 using standard profile and use default theme.
  2. Create several Basic page nodes
  3. Create a view of Basic page content type, using a page display
  4. In the 'Pager' section click on the 'more link' and enable it
  5. In the text box for the more link text, add a string in excess of 128 characters in length.
  6. The string is truncated to the maxlength which is 128 characters.

Some fields in Core override the default maxlength attribute up to 1024 characters. There is no reason to not do so in this case.

Issue fork drupal-3258434

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DuaelFr created an issue. See original summary.

duaelfr’s picture

Status: Active » Needs review

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs tests, +Needs subsystem maintainer review

This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

This could use test coverage for this change.

Tagging for subsystem review just in case they had any thought.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

mrinalini9 made their first commit to this issue’s fork.

mrinalini9’s picture

Status: Needs work » Needs review

Created MR for the 11.x branch, please review it.

Thanks!

smustgrave’s picture

Status: Needs review » Needs work

Was previously tagged for tests which are still needed.

Please read the tags and comments before putting into review to not delay the issue.

shalini_jha’s picture

Assigned: Unassigned » shalini_jha
shalini_jha’s picture

Assigned: shalini_jha » Unassigned
Status: Needs work » Needs review
StatusFileSize
new63.86 KB

I have added test coverage for this functionality and thoroughly tested it. The pipeline has also passed successfully. I am now moving this to the 'Needs Review' stage.
Please review.

smustgrave’s picture

Status: Needs review » Needs work

Comment on MR.

oily changed the visibility of the branch 3258434-increase-linkurl-field to hidden.

oily’s picture

Issue tags: -Needs tests
oily’s picture

Not sure if this needs a change record..

smustgrave’s picture

Not 100% but leaning on yes maybe?

oily’s picture

There is now a failing test in place. An error message seems to be getting generated when a 'long' url is used.

So it seems that the test coverage is sound. But the fix is not. It does not make the test pass. The failing test indicates that an error message of some kind is triggered by the test. It seems more work is required.

oily’s picture

@smustgrave Will compute 'yes maybe' == 'yes' : )

oily’s picture

oily’s picture

StatusFileSize
new228.42 KB

This series of screenshots shows the user experience without the MR applied.

  1. Install Drupal 11 using standard profile and use default theme.
  2. Create several Basic page nodes
  3. Create a view of Basic page content type, using a page display
  4. Screenshot shows the views configuration with 'More link: No' in the 'Pager' section
  5. Screenshot shows modal to change the 'No' to 'Yes'
  6. Screenshot show the box where you enter the text for the 'More link'
  7. Screenshot shows the view preview with the more link text truncated to maximum length if you exceeded it
oily’s picture

Created a change record.

oily’s picture

Issue summary: View changes
oily’s picture

The test is failing because there are in fact classes in the page source named 'messages' which have nothing to do with errors.

But the increased maxlength property does not prevent link text > 128 characters from being chopped off at 128. I also tried adding a size property and setting that to > 128 characters. But that has no effect on the textbox either.

oily’s picture

Some fields in Core override the default maxlength attribute up to 1024 characters. There is no reason to not do so in this case.

Yes, but these fields are using a different field widget. I think that a new field widget needs to be created and associated with the core textfield. The link-url form field would then use textfield and the new widget.

Regarding the functional test, what seems necessary is to save the view with the elongated link-url. Then visit the view page and assert that the page contains the full link-url text (as a link). Then click the link and assert that it loads the page/ modal it is supposed to.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

duaelfr’s picture

StatusFileSize
new1.92 KB

Rerolled MR on main branch
Patch attached for composer