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
- Install Drupal 11 using standard profile and use default theme.
- Create several Basic page nodes
- Create a view of Basic page content type, using a page display
- In the 'Pager' section click on the 'more link' and enable it
- In the text box for the more link text, add a string in excess of 128 characters in length.
- 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.
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | View-modal-configure-more-link-text.png | 228.42 KB | oily |
| #23 | view-preview-with-truncated-more-link-text.png | 171.7 KB | oily |
| #23 | View-modal-configure-more-link.png | 249.01 KB | oily |
| #23 | View-configuration-with-pager-section.png | 323.81 KB | oily |
| #15 | failing_test_without_solution.png | 63.86 KB | shalini_jha |
Issue fork drupal-3258434
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
Comment #3
duaelfrComment #6
smustgrave commentedThis 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.
Comment #9
quietone commentedClosed older issue as duplicate, adding credit #2954652: Increase character length for custom url on views
Comment #12
mrinalini9 commentedCreated MR for the 11.x branch, please review it.
Thanks!
Comment #13
smustgrave commentedWas previously tagged for tests which are still needed.
Please read the tags and comments before putting into review to not delay the issue.
Comment #14
shalini_jha commentedComment #15
shalini_jha commentedI 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.
Comment #16
smustgrave commentedComment on MR.
Comment #18
oily commentedComment #19
oily commentedNot sure if this needs a change record..
Comment #20
smustgrave commentedNot 100% but leaning on yes maybe?
Comment #21
oily commentedThere 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.
Comment #22
oily commented@smustgrave Will compute 'yes maybe' == 'yes' : )
Comment #23
oily commentedSee below.
Comment #24
oily commentedThis series of screenshots shows the user experience without the MR applied.
Comment #25
oily commentedCreated a change record.
Comment #26
oily commentedComment #27
oily commentedThe 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.
Comment #28
oily commentedYes, 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.
Comment #30
duaelfrRerolled MR on main branch
Patch attached for composer