Updated: Comment #N
Problem/Motivation
In #1857256: Convert the taxonomy listing and feed at /taxonomy/term/%term to Views it became clear that in some rare cases (you are a module developer) you want to provide a route
prefixed with your module. If you use yml files you can control the route name, so you put it prefixed with your name. In case you never actually
want to write code for yourself but just let views take care about it, you need a way to control that routename.
Proposed resolution
This patch adds a little textfield into the views UI that allows to specify the used route name. By default though views still generates a route name like "views.$view_name.$display_id".
Remaining tasks
User interface changes
API changes
Related Issues
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | interdiff.txt | 1.62 KB | dawehner |
| #15 | vdc-2138667.patch | 3.12 KB | dawehner |
| #14 | Screen_Shot_2013-11-28_at_3.29.18_PM.png | 53.18 KB | webchick |
| #13 | interdiff.txt | 880 bytes | dawehner |
| #13 | vdc-2138667.patch | 3.42 KB | dawehner |
Comments
Comment #1
dawehnerI just love using unit tests.
Comment #2
tim.plunkettOh this is reeeeallly cool.
Comment #3
webchickHelp. :)
Comment #4
amateescu commentedThis sentence sounds a bit funky :)
Also, what happens if the route you put there requires some parameters?
Comment #5
dawehnerIn that cases you need #2138665: Allow to specific route parameters to be defined via the views UI
Comment #6
dawehnerComment #7
damiankloip commentedHow about:
"For advanced use cases, you might want to set a specific route name."
?
Comment #8
amateescu commentedShouldn't they be a single patch then?
Comment #9
dawehner/me sighs.
I splitted it up orginally, because these two functions don't rely on each other, so they are easier to review per single patch.
Comment #10
amateescu commentedIMHO, they might not rely on each other, but they also don't *work* without the other :) And the patches are quite small..
Comment #11
dawehnerWell, you can use this patch certainly without the other one. The other way round might by not important, though still usable.
Comment #12
webchickThanks for adding some explanation for "outsiders" to this issue. :)
So, reading between the lines, it sounds like you would use this if you wanted to have a View "take over" an existing route that was already in core/contrib? Like if we had kept the node front page at /node with a route name of like node.frontpage, we would need this in order for Views to provide its override, and it would do so by also specifying node.frontpage as its route name. Correct?
If that's so, we should really clarify that in the field description, since that sounds very useful, and also not especially advanced. Something like:
"Use this to override an existing path defined by another module, by entering the same route name."
(If I'm way off base on my assumptions of what this field is for, btw, I'd still like to see a description here that gives some clue as to when to use this field and how.)
Based on the example of e.g. admin page overrides that don't take parameters, I think this is OK to handle separately from #2138665: Allow to specific route parameters to be defined via the views UI.
Comment #13
dawehnerThank you for looking at that patch.
Thank you! Yeah that previous sentence was indeed horrible.
Views in HEAD currently overrides existing routes automatically, so you don't have to specify it. This is done using some magic,
so this additional configuration here is just for module developers you never actually want to implement their own routes.
So to summarize: You should not use that field to override an existing route, though there won't be any difference in the way how it works.
I have the opinion that people should not deal with machine names if not needed. One example is the display ID in a view, though people seem to change them regularly.
Comment #14
webchickAh-ha! I think I get it now. So it's only for if you care about the cleanliness of the route machine name, which in 99.9% of cases you don't, because it'll just be auto-generated as view.blah.blah and that is totally fine. Why is this a major bug report and not a normal feature request then..?
Then I guess my only question is if the audience is module developers, then why does this belong in the UI at all, when presumably module devs could just hand-edit their YML files to change the route name for their module's default config themselves. If it does stay in the UI, it should probably be moved under the "Advanced" fieldset somewhere. Because right now it's smack in the face of people who are setting a Path, which is at least an 80% use case in the Views UI, for what is probably a 2% use case (only for module developers who care about route name cleanliness). I get especially worried about this if #2138665: Allow to specific route parameters to be defined via the views UI also goes in, since it'll only make this same form even longer and more complex.
If I have misunderstood, again, I might need smaller words. :P
Comment #15
dawehnerSo well, I consider it as a big problem that it is not possible at the moment to throw away the current code of taxonomy/term/{} and replace it completely by a view, but sure this position can be argued.
You always need an route entry which has a new like the following:
taxonomy.term_pageThe new patch just provides the functionality on the API level and will work if you put it into the yml file. Sadly the developer won't ever notice, as we don't really use config schema yet as documentation
for available parameters in a route even we could sort of.
Comment #16
olli commentedIs it possible to add this setting under the advanced section?
Comment #17
dawehnerWell, this is sooo connnected to the path setting, I am not sure whether we want to add even more items.
Comment #18
tim.plunkettI am torn between dawehner and webchick here, both have very good points.
But, the last patch is a very good compromise (just the API addition).
RTBC, thanks dawehner.
Comment #19
dries commentedLooks good. Committed to 8.x.