Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Forcing the more link to always display causes an exception when there is no route, i.e. I have no page view to more link to..., however users can check this option in Views UI and kill their site, with no understanding of what just happened.
Proposed resolution
Don't allow users to check this option when there is no page view, OR allow users to set the path to a page/node whatever to "more link" to. Either way, this is a pretty nasty site builder wtf just happened to my site problem.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#26 | 2428643-26.patch | 2.84 KB | Upchuk |
#23 | 2428643-23.patch | 2.82 KB | Upchuk |
#23 | interdiff-23.txt | 997 bytes | Upchuk |
#20 | 2428643-20.patch | 2.82 KB | Upchuk |
#20 | interdiff-20.txt | 1.54 KB | Upchuk |
Comments
Comment #1
dawehnerThank you for creating an issue.
Note: fixes should be filled against the recent version of the code.
Comment #2
Upchuk CreditAttribution: Upchuk commentedWill take a stab at this.
Comment #3
Upchuk CreditAttribution: Upchuk commentedHow about this?
A check inside the validation of the display.
If the approach is good, will go ahead with writing a test.
Comment #4
dawehnerMh, while this is certainly nice to have here, i'm a bit curios whether we really don't want to have a form level validation, which stops the user from saving the form.
Comment #5
Upchuk CreditAttribution: Upchuk commentedAdding an error in the validation there prevents the form from being submitted as well. It's the same behaviour as with creating a Page display without specifying a path to it. Whenever the view executes, the validation will fail and you get the message in red. You can't save the form in that state either.
Comment #6
dawehnerWell, but I kinda prefer the inline validation as it has a better UX, IMHO.
Comment #7
Upchuk CreditAttribution: Upchuk commentedHere we go. A fix + a test.
Comment #9
dawehnerIt looks great!
Comment #10
mpdonadioYeah, I think inline validation is better UX and DX; it will help prevent weird situations like #2446783: Views preview not working without saving new display.
Comment #11
Upchuk CreditAttribution: Upchuk commented@dawehner, I still want to add a little test to also check if the page display is removed completely. Currently it only disables it. The patch includes a check for both disabled and non-existent and the test should reflect both :)
@mpdonadio This cannot be implemented inline. I'm sorry I forgot to add a comment about this as I discussed this on IRC with dawehner a while ago. The problem with inline validation is that the form section responsible for turning on the 'more' link is different than the one responsible for selecting a custom url or a page display or whatever. So you end up in a situation that you won't be able to turn on the 'more' link because the other section (the link selection) will be by default set on 'None' (which will error out).
Comment #12
Upchuk CreditAttribution: Upchuk commentedHere we are, some extra checks.
Comment #14
Fabianx CreditAttribution: Fabianx commentedRTBC, looks great now!
Comment #15
dawehnerI'm sorry for my slacking +1 from me.
Comment #16
Upchuk CreditAttribution: Upchuk commentedWhat slacking? You've been super helpful :)
Comment #17
catchWhat happens if you configure this (when the validation would pass), but then later delete the display that can be linked to?
Comment #18
Upchuk CreditAttribution: Upchuk commentedThe validation gets called after many actions on the view. So just like test indicates, you can configure it properly but then when the validation gets called again, it fails if there is no valid page display with a path.
Comment #19
catchHmm I see that in the test now, it's not obvious from the comment though what's happening. Upchuck talked through in irc.
1. You have a valid View
2. You disable the page display which would make the view invalid
3. When you try to save, you get the validation error - because the path no longer has anywhere to point to.
So we don't stop you disabling the page display, but we then don't let you save the view until the master is updated.
That prevents the error I had in mind, I can see people getting confused when it happens but it's consistent with the page display never having been there at all.
Would change the comment to something like:
'Confirm that the view does not validate when the page display is disabled.'
But seems OK.
Comment #20
Upchuk CreditAttribution: Upchuk commentedHere we go.
Comment #21
Fabianx CreditAttribution: Fabianx commentedBack to RTBC
Comment #22
alexpottWe don't use please in our UI text.
Comment #23
Upchuk CreditAttribution: Upchuk commentedHere we go.
Comment #25
dawehnerPlease, don't use "please" in our UI.
Comment #26
Upchuk CreditAttribution: Upchuk commentedDamn it, forgot to update the test as well :)
Comment #27
dawehnerBack to RTBC
Comment #28
alexpottThis issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 0fd920c and pushed to 8.0.x. Thanks!
This would have introduced the first use of "You'll need" into core. I changed this to "You need"