Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
views_ui.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Aug 2013 at 17:02 UTC
Updated:
29 Jul 2014 at 22:47 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettUntil #2060859: Make Block plugin's "category" a translatable string goes in, this doesn't make much sense, but here it is.
Comment #2
dawehnerYou have to adapt the schema as well. The rest looks perfect. It seems to be that webchick requires to use the base table as the default value?
Comment #3
tstoecklerI think this should be something like:
"... as the category of this block on the blocks placement page" (or whatever that page is called).
Comment #4
damiankloip commentedUsing a views_ui method here bugs me. That is not the fault of this patch though, I might make an issue to sort that out.
Might as well just not assign the $category variable?
I agree with #3, but maybe tweaked; something like 'The category this block will appear under on the blocks placement page' ?
Comment #5
tim.plunkettI even found a bug!
Comment #6
dawehnerYou are a lucky guy that this does not break anything. My previous attempts to use configuration in defineOptions all went into the problem that at some point defineOptions is called again. I am feared that this could bite us at some point.
Additional I think we should not use translated values here as default values.
Comment #7
olli commentedThe link doesn't work, it takes me to admin/structure/views/view/archive/edit/admin/structure/blocks.
I think we need to sanitize the category if it's user input.
Comment #8
tim.plunkettYeah, I was pretty sure that would break something. Hm...
And yes, I meant to remove the t(), that's just habit :)
Comment #9
tim.plunkettThanks for the reviews. I've also added tests.
Comment #10
dawehnerIs it just me that we test the actual produced HTML? I don't know but it feels better to not add everything into the select chain?
Comment #11
tim.plunkettIn IRC, @dawehner clarified his comment in #6.
For the most part, defineOptions() has only static values, nothing dynamic, and certainly nothing pulling from an external service.
In order to maintain that, I've switched this around to determine the base table when adding a new block, either from the wizard, or while editing a view.
I also removed some of the irrelevant HTML as mentioned in #10.
Additionally, we're testing the wizard, instead of using a shipped block.
Comment #12
dawehnerIs there already a follow up to fix the ":" in URLs problems?
Comment #13
tim.plunkett#2035345: Reconsider whether to use ':' as separator for derivative plugins, which you opened :)
Comment #14
tstoecklerI think the standard is to use url() in these kinds of situations. Since we're still using t() also, I think that would be OK, even nowadays.
Comment #15
alexpottPatch no longer applies
Comment #16
tim.plunkett#14, I copied this straight from core.
Straight reroll, just use statements conflict.
Comment #18
tim.plunkett#16: vdc-2071019-16.patch queued for re-testing.
Comment #20
tstoecklerRe #16: Sorry for not being more precise. Embedding the
<a>tag in the string is correct indeed. But for the t() placeholder I think it makes sense to useurl('admin/structure/blocks')instead of embedding the path directly. That's what's done throughout core.Comment #21
tim.plunkettAHHH!
@tstoeckler++
That explains why it doesn't fail for me, because testbot is installed in a subdir.
Comment #22
tstoecklerRight, of course I was totally arguing on a technical level and not for mere consistency/nit-picking-reasons... ;-P
If this was RTBC before, it certainly is now. Unless bot disagrees again.
Comment #24
tim.plunkettOh wait, that has nothing to do with this fail. But I cannot reproduce via Simpletest UI, and I don't know how to debug xpath from the CLI.
Comment #25
tim.plunkettThis worked with run-tests locally
Comment #27
tim.plunkettme--
Comment #29
tim.plunkett#27: vdc-2071019-27.patch queued for re-testing.
Comment #30
tim.plunkettRight now this random fails. But I found it!
Comment #31
tstoecklerWow, nice debugging!
Still looks good.
Comment #32
olli commentedSorry, found two small bugs while simplytesting.
The path is admin/structure/block.
String::checkPlain is not needed here and would cause double escaping.
Comment #33
dawehnerWe totally should add the schema, see my review in #2 :)
Comment #34
webchickNo longer applies. :(
It is not clear what addDisplay() vs. newDisplay() is. I approached bikeshedding this with Tim a bit, but he pointed out that this confusion is a pre-existing condition (newDisplay is defined on the View object, this is simply re-propogating it here where it's needed). So let's get a follow-up to fix this from a more holistic POV, and also fix the docs so they refer to where this method is properly documented.
Otherwise, this looks good code-wise. Haven't had a chance to manually test yet.
Comment #35
tim.plunkettOpened #2082157: Move View::newDisplay() to ViewExecutable
Comment #36
dawehnerThat is fine for now.
Comment #37
webchickOk, now played around with this as a user. Overall, it worked great! Here's a walkthrough:
I LOVE this, since it picks a smart default that'll work in 90% of cases, most likely:
However...
A text field for this isn't going to fly; it opens a site up to data integrity issues. Since we lack a "select or add one" pattern in core to employ here, we should fall back to autocomplete as a workaround. Needs work for that.
I also found one other weird thing:
I've no idea why we are exposing this kind of implementation detail. We don't prefix other blocks with "Module:" or "Custom:" From talking to Tim, this is a historical artifact from Views D7 and below, since often you'd end up in a situation where there was both a "Core" Recent comments block and also a "Views" Recent comments block, and you needed to differentiate between them. However, with Views in core, and with an initiative well underway to try and convert all of those crappy listing blocks to Views, I don't think this makes sense anymore. However, it wasn't introduced in this patch, so marking "Needs followup" for that.
Comment #38
tim.plunkettAgreed that we should revisit the "View: " prefix on blocks.
Here's autocomplete, with a unit test. No point in a test-only patch, since it will try to use a class that doesn't exist...
Comment #39
jibranOh I like this part.
Comment #40
dawehnerThat function sounds a bit like net cheese in german.
Comment #41
olli commentedOh, cr.. #32. This was for another issue, sorry!
Comment #42
tim.plunkettThese are called on the wrong object after #2082157: Move View::newDisplay() to ViewExecutable. Working on more test coverage
Comment #43
tim.plunkettAdded more test coverage.
Comment #44
olli commentedNice work @tim.plunkett!
Should we use stripos instead?
Needs a checkplain for the value.
Comment #45
tim.plunkettGood points for both. Adding test coverage.
Comment #46
jibranAs #37 is addressed. Screenshot is in #38 and we have nice test coverage. Unable to find aything in code review so putting back to RTBC.
Comment #47
webchickPerfect!!
Committed and pushed to 8.x. Still need a follow-up for the "Views:" string. I'd create it myself, but I'm not sure I could adequately describe where that code is and what it's doing.
Comment #48
damiankloip commentedCreated that follow up; I should that should be adequate, and very simple. Unless I'm missing something :) #2086447: Remove 'View:' prefix from views block derivative admin labels
Comment #49
tim.plunkettThanks!