On #1938062: Convert the recent_comments block to a view it came up, that people should maybe not have access to the full view settings, but change just some certain bits of it,
in order to maintain the UX of Drupal 7 and possible access problems when dealing with the full views UI.
The proposed overrideable settings are:
- items per page
- link to the view / should there be a more link
Therefore the block display plugin can alter the settings of a block view, so contrib could provide more then the two mentioned points above.
Comment | File | Size | Author |
---|---|---|---|
#115 | 1957346-115.patch | 23.01 KB | damiankloip |
#115 | interdiff-1957346-115.txt | 2.45 KB | damiankloip |
#110 | vdc-1957346-110.patch | 22.68 KB | dawehner |
#110 | interdiff.txt | 5.97 KB | dawehner |
#108 | vdc-1957346-108.patch | 22.27 KB | dawehner |
Comments
Comment #1
dawehnerHere is a start for the views part of it, though we should certainly discuss how it should look on the block configuration page.
My idea was to group the settings into: pager related settings, link related settings and exposed_form and finally a fields override.
All of these groups could be put together in a vertical tab.
The title override would probably take care about the label #access setting.
Comment #2
Bojhan CreditAttribution: Bojhan commentedThis honestly sounds like a really bad idea, that should be placed in contrib and not core. You are duplicating functionality, which means there is a large chance that people will confuse in which two places to go to edit the settings. Given that this usecase could easily be dealt with contib, I dont see why we would introduce such a large usability risk in core?
Comment #3
xjm@Bojhan, see #1938062-58: Convert the recent_comments block to a view. Something like this is necessary to allow the configuration of the number of items through the block UI. @webchick has stated that this is a commit blocker for using Views for block listings, because content authors should be able to configure these options without going to the Views UI. I don't feel strongly about it, but I am willing to make this change to convert blocks to Views.
@dawehner, my idea was that we would always expose (some of) these options in the Block UI, so there would not need to be configure the options in the View.
Looking at the list:
Comment #4
dawehnerAs on the title we should certainly try to allow the user to choose whether he actually want's to override it.
Comment #5
YesCT CreditAttribution: YesCT commentedSo this issue can just do:
Number of items
More link
The rest in contrib.. Which someone could write now and we could play with.
Comment #6
Bojhan CreditAttribution: Bojhan commented@xjm I am not sure, webchick is be correct that we shouldn't regress on usability. But I feel little for just hopping over functionality at our own determination, if anything we should provide 1:1 functionality for the blocks we convert but adding new functionality is not something I think we should even try.
Ideally though, we still don't go down this road because it means duplicating functionality, override troubles etc. Even though it regresses usability, its also the result of moving to a new model - trying to keep the old model just because the views UI isn't as user friendly sounds like a bad idea. Centralisation of functionality means we can provide more resources to optimise it, having it all over the place means a distributed effort and will be harder in the long run. Although it might not be in scope of D8, providing work arounds to the real problem always ends up with nasty UX problems - so if anything lets try to minimize this as much as possible.
Comment #7
YesCT CreditAttribution: YesCT commentedneeds issue summary update to clarify the scaled back approach. Also that #1938062: Convert the recent_comments block to a view is blocked, waiting on this.
Comment #8
xjm@YesCT, we don't have consensus here yet. For the moment, I'll simply update the summary to indicate that. I'll add a more complete summary once the VDC team has discussed it more with the usability team.
Comment #9
xjmAlso, we eventually need to discuss with webchick (and possibly Dries and catch if we can't come to an agreement) whether this is actually a blocker for block views. #1957276: Let users set the block instance title for Views blocks in the Block UI also blocks that issue, and the solution we choose there might have implications on what we do here.
Comment #10
xjmI think this is actually a
views.module
issue, because we own the plugin.Comment #11
YesCT CreditAttribution: YesCT commented@xjm thanks. :)
Comment #12
tim.plunkettI think we have to double down on this approach to get *any* blocks converted for D8.
This is the best option we have for a bridge between the Block UI and the Views UI, and it is straight from contrib.
Comment #13
webchickJust to clarify my stance:
- I don't care as much about configuring number of records; core is inconsistent with itself on whether or not that's supported on a per-block basis, and it's pretty rare to have to change it, so not the end of the world to tweak it in Views UI.
- I care a lot about configuring the block title, though. Every single other modules' blocks offers this capability, and users aren't going to understand why they can do this on e.g. their $foo block but not their $bar block. It's just going to be a completely inconsistent UX. And because this is directly in the face of users, it's something that less technical people like content authors are likely to want to tweak themselves.
Comment #14
webchickOops sorry, cross-post.
Comment #15
dawehnerReduced the items to items per page and more link. Additional I talked with tim and we agreed that the display block plugin should define the available options, so this passes further all the block related functions.
Comment #17
Bojhan CreditAttribution: Bojhan commentedI just wanted to add some context, because I feel my position is being misunderstood. I am mostly worried about duplication and inheritance, from my point of view the Views interface should be the end point - we wish to get people at. Having intermediate steps, like block configuration of certain variables - is very useful, to a lot of users, however it also introduces the possibility of confusion - and when it comes to inheritance and duplication, this can get bad really quickly (e.g. people reaching for the wrong tool for the job).
Tim explained to me that we don't want people to make 5 display's (for 5 different pagers), although I understand this position - I am puzzled that creating more displays adds so much overhead. I think our long-term goal, should always be to provide one interface for the job - not two, that might mean turning technical concepts like displays on their head and/or vastly improving on the UX of Views. But from a UX point of view the desirable option in my mind is to unify towards one interface, not distribute to several. That way people know where to go, and know if its not there - it won't be at another place. I can see, that this is D9 talk.
A solution for what we currently have is to make the "connection" more clear, or we presented it over the past few years "to connect the dots". In this case there are two places where you can connect the dots, when configuring the block and when configuring the view. I have mocked up an example of this below:
A quick pointer, that this is comming from a view and you are overriding it here. The wording will need some work.
A pointer that changing this is fine, but it will leave Blocks X, Block Y unaffected.
Comment #18
webchick"But from a UX point of view the desirable option in my mind is to unify towards one interface, not distribute to several."
I don't think that holds from a security POV, though, which was one of my points in the other issue. Giving people access to Views admin gives them access to all the content, users, etc. in your database. I think we really do need an interim solution that gives people access to edit some parts of the View (primarily the end user-facing bits) without giving them access to harvest peoples' e-mail addresses or view normally OG-protected content. I agree that explaining inheritance is difficult, but I don't think giving "access full database" permissions to every weirdo who needs to make a landing page on your site is a workable solution.
Comment #19
tim.plunkettYes, and this solution is one easy way to delegate limited power on a per-view basis.
You can say "this view can have a configurable pager" and "this other view can have a configurable more link" and those who can only place blocks don't need an admin to tweak views each time.
It's one of the major benefits of panels/panelizer and the panels IPE.
Comment #20
Bojhan CreditAttribution: Bojhan commented@webchick I know its D9 talk, but I'd imagine we could also provide a "limited view access" that gives acces to the same functionality we now wish to expose in blocks. I don't think its feasible to split up all permissions, but it should be possible to provide limited acces.
Comment #21
peteruithoven CreditAttribution: peteruithoven commentedInteresting discussion. I agree with Bojhan especially with the following:
"moving to a new model - trying to keep the old model just because the views UI isn't as user friendly sounds like a bad idea."
Why not apply the trick we apply in the rest of Drupal? We add more permissions that give users more or less acces to parts of the Views UI. When a user only has the permission to edit the "Page settings" and "Pager settings" he only sees thinks like the Title and pager settings.
This way a site admin can control the acces (and complexity) for roles as he is used to.
Comment #22
dawehnerI guess such an improvement would be too complicated for drupal core, though maybe views should expose a way that contrib can extend this functionality later.
Comment #23
peteruithoven CreditAttribution: peteruithoven commentedI'm probably heavily under estimating the complexity of the Views UI, but shouldn't this be something like rendering or not rendering parts of the interface using if statements based on the permissions of the current user? The fact that this permission system is already used throughout Drupal should also help.
Also compared to adding a new interface, thinking out how stuff should overrule each other, design warnings here and there to point people towards these overrulings, designing the extra configuration to edit the blocks UI from the Views UI.
Comment #24
tim.plunkettIf this were D7, where each Views block display resulted in one Block placed into a region, that'd be trivial.
But now that a single Views block display can be placed infinite times by the Block UI, we have to devise an addition to the Views UI that will scale.
Comment #25
peteruithoven CreditAttribution: peteruithoven commentedHi Tim,
Could you clarify? What do you think will not scale? What do you think will scale?
Comment #26
tim.plunkettI think adding any functionality of the Block UI to the Views UI will not scale.
I think adding links, as above, will scale.
Comment #27
jibran#15: drupal-1957346-13.patch queued for re-testing.
Comment #29
xjmOne minor note:
This isn't necessary--the parent implementation's submit handling is in the
submit()
method, andBlockBase::blockSubmit()
is an empty stub.Comment #30
xjmI think that, just in case, we should have a point at which it switches over to saying "in N blocks" in case some contrib on some giant site is using the block system in a way we don't expect. ;)
Comment #31
dawehnerWell, maybe there will be something in there in the future so adding it prevents a potential bug.
Just a rerole.
Comment #34
xjmWell, actually the whole point of the
blockFoo()
methods is that you don't have to call the parent.Comment #35
jibranReroll and some doc and form fixes.
Comment #37
dawehnerWorked on getting some actual UI, not failing settings() method and some proper unit tests for the block plugin in general.
Comment #39
jibranI think t is service now.
Comment #40
dawehnerWell, but t() is stilled called from everywhere so we have to replace it.
Comment #42
ParisLiakos CreditAttribution: ParisLiakos commentedabout t(): lets not start injecting things, unless absolutely necessary till #2018411: Figure out a nice DX when working with injected translation is in:) (RTBC plz!)
but we should link to that issue instead in the @todo note, since jibran is right, its already a service:)
hmm dunno about that:/
why dont just do the same with t()? add a
views_add_contextual_links
function that does nothing at allneeds removal
Comment #43
dawehnerYeah this is a good idea.
Comment #45
dawehnerLet's upload a screenshot, let's hope the WLAN allowed the upload.
Comment #46
jibranThese are not required as @xjm suggestion in #34
Comment #48
damiankloip CreditAttribution: damiankloip commentedCan we use empty() or isset() instead here?
Needs a param, or can it use an {@inheritdoc}, not sure.
thank you!!
Comment #49
dawehnerThe problem is , this method is coming from the block so it is not defined as the parent.
This patch fixes the reviews as well but one of the php unit tests don't work yet.
Comment #51
dawehner#49: vdc-1957346-49.patch queued for re-testing.
Comment #53
ParisLiakos CreditAttribution: ParisLiakos commentedthis will fix the phpunit test
Comment #55
dawehnerLet's fix some of those.
Comment #57
dawehnerI hope this should fix as many as possible.
Comment #58
damiankloip CreditAttribution: damiankloip commentedThis patch looks great, and works nicely. You just forgot to call the parent in ViewsBlock::form, so I added that while I was testing and peace is restored once more.
I will RTBC once it comes back ok.
Comment #59
olli CreditAttribution: olli commentedShould this use array_keys(array_filter(..))?
Is this method still needed?
Comment #60
dawehnerjess told me that the concept of the block interface is that just the plugin will care about it, so don't call the parent.
But then it again does not match with the option definition etc. I think it is fine to go with it like it is now.
Comment #61
dawehnerComment #63
dawehnerDamian, i was so wrong.
Comment #65
olli CreditAttribution: olli commentedAdded a check for invalid display.
Comment #67
olli CreditAttribution: olli commentedComment #68
dawehner+1 for 65 and 67, though I hope this problem will never appear once we automatically remove the block entries.
Comment #69
dawehnerComment #70
jibranLet's wait for @xjm or @tim.plunkett
Comment #71
tim.plunkettThis can now just be
$view = $storage_controller->load($name);
The === scares me, what if its '0' or '1' from CMI?
Now you should be able to do ViewsBlock::create($this->container, array(), $plugin_id, $plugin_definition);
This looks odd.
Comment #72
dawehnerGood point
Let's typecast for now.
Do you have a better suggestion? This allows you to remove it really easy, once the workarounds for t()/views_add_contextual_links are in.
Comment #73
olli CreditAttribution: olli commentedComment #74
tim.plunkettOh, I just missed this curly brace, which throws off the indentation.
Interdiff looks good, thanks!
Comment #75
alexpottWe need an issue summary update as we are at rtbc but the first time of the issue summary is:
:D
Comment #75.0
alexpottUpdated issue summary.
Comment #76
alexpottI love PHPUnit tests as much as anyone but we also should be testing that the new form elements appear and work as expected though the Block UI. Also reading the issue summary can we confirm that we've tested the ability for contrib to extend? I would have expected a test module to do this...
Comment #77
dawehnerIf you would want more options you would provide a different views display plugin, replacing the existing one provided by views.
Here is a UI test.
Comment #78
olli CreditAttribution: olli commentedRe #59 "Is this method still needed?":
I think that method was not called, but actually, it would make sense to add that back and move these from ViewsBlock::build() in there:
This way all overrides related code would be in display plugin, right?
Comment #79
xjmAlso. Since we're purportedly doing all this for the content author UX, let's make sure we meet that goal.
Comment #80
dawehnerThere is no need for manual testing, ... we have unit tests, so what should possible go wrong.
@olli
I agree with you, let move that bit.
Comment #82
dawehner#80: vdc-1957346-80.patch queued for re-testing.
Comment #84
dawehnerurgs.
Comment #86
dawehnerlet's fix it.
Comment #87
dawehnerHere are some suggestions for better UX.
Comment #88
tim.plunkettI RTBC'd this before, and manually tested it.
The last patch is a nice improvement in the usability.
Thanks @dawehner and @olli!
Comment #89
yoroy CreditAttribution: yoroy commentedDisplay more link setting didn't work for me. I had 6 articles, a views block set to show 10. I configure the block to show 5 (this works) and to show the more link. No more link was shown
UI review:
I think these added settings should be shown below the 'region' select list. One of the ways to get to this page is through 'Place block' link on the Blocks overview page. The region select list is how you place a block. Of course when you click to configure from a contextual link you might well come for the two settings added here, but then it's only 1 select list that you have to skip over.
Also, do we have to communicate that you're overriding things? I'm not sure about the usefulness of having these in their own details section.
I don't understand the 'override items per page' and 'override more link' as the default values in the select lists. What are these supposed to communicate? Is this what you often see phrased as "-- select a value -- ?
It's also not clear what the current values are.
Comment #90
tim.plunkett@yoroy, you tested the wrong patch.
Comment #91
yoroy CreditAttribution: yoroy commentedI did :-\
Still leaves to review:
- wether these need their own details section
- ordering of all ui elements. I think these should come below the region select list
Does my more link not show because I don't have a page defined for this view? Then I shouldn't be able to select it.
Comment #92
dawehnerOkay let's remove the more link setting for now, as it is just less important then the more link.
Comment #93
yoroy CreditAttribution: yoroy commentedI think that makes most sense yeah.
At the very least lets not have the non-editable machine name sit in between two actionable items.
Comment #94
dawehnerWe can't at the moment, seriously.
Comment #95
tim.plunkett@dawehner shouldn't have RTBC'd, but I was about to anyway.
Thanks @yoroy!
Comment #97
dawehnerRage patches never work.
Comment #98
dawehnerRage patches never work.
Comment #99
tim.plunkettAhh, yes. Thanks for killing the leftover tests.
Comment #100
sdboyer CreditAttribution: sdboyer commented+1 RTBC
very glad we're adding these. looks like it should fit in nicely with #2025649: Add title-related methods to BlockPluginInterface to help clarify and resolve many issues, which i'm trying to get moving again.
Comment #101
alexpottI thought the "More link" was not going to be configurable from the block settings... looking at BlockForm method in the same class we only support items_per_page. Manually testing has confirmed the we need to remove the more link option here...
Why we are making this change?
Comment #102
dawehnerThis potentially fixed some issues yoroy had while testing, but in general this is a good idea, as it is faster: #2046531: Change use_more_always to default to TRUE
The main reason why we remove it from the patch is, because it potentially changes too much. What would you expect if you have configured views to look up that there are really more items, but there are not. ... We can potentially work on that in another issue, but this patch is mostly about unblocking all kind of conversions.
Comment #103
tim.plunkettThis comment is wrong.
Tests
I guess we don't want this anymore?
Comment #104
dawehnerComment #105
damiankloip CreditAttribution: damiankloip commentedIf we want this to default to have the checkbox checked as default, this would need to be 'items_per_page' instead of TRUE. This would be stored as an associative array anyway. or you could make the change in buildOptionsForm?
Otherwise, code looks good, and manual testing was good. That's all I found.
Comment #106
dawehnerThere we go.
Comment #107
damiankloip CreditAttribution: damiankloip commentedI think you just want:
'items_per_page' => array('default' => 'items_per_page'),
instead, otherwise the checkbox will still not be checked by default.Comment #108
dawehnerI as tired yesterday, so am I today, but maybe this is a good fix.
Comment #109
tim.plunkettThis could be a oneliner
I know this is technically correct, but I'm pretty sure we just use the non-mocked class name in typehints...
Tests
Do we have to call this all three times?
Same as before
:)
Tests
Comment #110
dawehnerThanks for the review!
I simply won't fight this.
Comment #111
tim.plunkettRTBC if green
Comment #113
tim.plunkett#110: vdc-1957346-110.patch queued for re-testing.
Comment #115
damiankloip CreditAttribution: damiankloip commentedHmm, we can't really just do setDisplay() in the constructor as it blows up when the plugin ID is invalid, and still tries to call methods on the wrong display, which the previous if () calls took care of.
Class property is missing from interdiff but in the patch. See interdiff for what I meant in #105 and #107.
Comment #116
tim.plunkettAh, very good point.
Thanks @dawehner and @damiankloip!
Comment #117
alexpottCommitted 9dd98ea and pushed to 8.x. Thanks!
Comment #118.0
(not verified) CreditAttribution: commentedupdated the summary