When placing a block in the core block UI, it lists all available blocks in a list. While it shows the category, it lists all the blocks from all categories together. This makes it difficult to "drill down" to the block you actually want -- especially after enabling a few contrib modules, creating a few views or creating a few content blocks.
Instead, we should show vertical tabs with a tab for each category, and only show the blocks for a category after the user has clicked the appropriate tab. This is similar to the "Add content" dialog in Panels in D7.
This way a user can say "Ok, I want to place a form, so I'll click 'Forms' to find the one I want", for example.
Ideally, this should be implemented as a reusable class that we can use in Panels and to override the core block placement dialog.
Comment | File | Size | Author |
---|---|---|---|
#12 | modify_core_block_ui_to-2604178-12.patch | 39.4 KB | sylus |
#12 | interdiff-modify_core_block_ui_to-2604178-12.patch | 12.52 KB | sylus |
#9 | 2604178.interdiff.txt | 20.44 KB | EclipseGc |
#9 | 2604178-9.patch | 27.75 KB | EclipseGc |
#8 | 2604178-8.patch | 25.06 KB | EclipseGc |
Comments
Comment #2
dsnopekComment #3
tim.plunkettThis doesn't actually modify the UI yet, but it takes over the controller and just calls parent:: for now.
Comment #4
dsnopekComment #5
EclipseGc CreditAttribution: EclipseGc commentedOk, what's there looks good, but obviously doesn't do anything yet, so NWing it.
Eclipse
Comment #6
EclipseGc CreditAttribution: EclipseGc commentedNot interdiffing this considering the minimal-ness of the original patch.
All sorts of issues here, so let's consider this a mostly working mock-up for the time being. Issues that have been discussed in other forums of communication include:
I've included the image here as well since it won't be available in the patch. Place it in the images/blocks directory. Let me know what the thoughts are.
Eclipse
Comment #7
japerryInteresting, by default, custom created blocks (which did appear in the core blocks system) do not appear with this patch. I suppose this could be considered a bug or a feature! See #2626942: Creating Custom Blocks that are not re-usable for more info.
Comment #8
EclipseGc CreditAttribution: EclipseGc commentedOk, no interdiff because it's REALLY different. I ejected jquery.ui.tabs in favor of building something custom. This is because tabs was expecting full page renders that it would then replace the contents of a div with. This seemed ugly in general, and also likely to fail as soon as we were rendering blocks in the list since some have attachments and that particular methodology would be prone to failure in that situation without being REALLY heavy handed.
The result is a set of code I a.) like better and b.) am in complete control of (perhaps those two things are related? I can't tell at this vantage point).
I've introduced a block_ui plugin type. This is maybe 50% baked at the moment and needs some more love. Likewise the Icons implementation of that plugin contains a lot of code that can perhaps be abstracted. We need to do due diligence on this and make sure that I didn't force some sort of dependency on what my expectations for the content of those "tabs" were. There are a number of known bugs in this code:
I think this is a big step in the right direction, and a bit of the blocks code we've introduce here will ultimately migrate into ctools_blocks. Next steps are to fix the known problems and then I want to introduce a new plugin type for custom block types. This would ultimately allow us to do things like add "Content blocks" or introduce a custom plugin for building new views (crazy but just an example) etc etc. It's a plugin as a platform for handling non-standard block types (which core posses two of, content blocks and views).
Same image from the previous patch still applies. This patch should now apply cleanly.
Eclipse
Comment #9
EclipseGc CreditAttribution: EclipseGc commentedOk, I reworked things to make them saner and more extensible. A lot of cleanup between the Icons class and the BlockUIBase could still happen, but this is beginning to move in the correct direction. The filter form now expects a BlockUIInterface plugin to be injected into it, it then farms out the render process of the results it finds to the plugin, so it's pretty generic at this point. The plugins can expect their urls to come across the configuration now, likewise contexts come across config which is something we've done elsewhere in core. Long term, I intend on adding a filter for removing blocks from the list of available blocks based upon a block profile. Also, the "category" listing might should be a trait+interface or something. I'm still debating.
Give this a go, let me know what you think.
Eclipse
Comment #10
samuel.mortensonJust had a chance to review this, noticed a few things:
Functionally this seems good so far! Should we start work/issues in tandem with this to make sure that other UIs that list blocks (Page Manager's Block Display, Panels's Variants, etc.) can use this as well?
Comment #11
mpotter CreditAttribution: mpotter commentedIs there a way to add a "category" for creating new instances of custom block types? Sort of like the static content widgets that we used to have at the bottom of the Add Content form in D7. Right now you can add new block instances from the Blocks page and from the IPE (Create Content), but not from the Page Manager UI. So in terms of consolidating the UIs this would be an important piece not to miss.
So maybe a tab called "New Block Content" or something like that. This is different than just selecting the Blocks category for an existing custom block instance.
Comment #12
sylus CreditAttribution: sylus commentedI am just rerolling the patch which won't apply to latest dev anymore (services.yml). I also took care of the first 3 issues that samuel.mortenson noticed.
1) I just moved $plugin_id into the function as isn't an expected param, not sure how we would get variations though.
2) This was because in some cases when there is no string we don't sent a response back.
3) Added the picture in patch.
4) Adjusted services.yml (not in interdiff).
Comment #13
tkoleary CreditAttribution: tkoleary at Acquia commentedWhy are we re-inventing vertical tabs here when we have it in core? Is there something special that this version provides that core does not?
Whenever we have ask contrib modules to provide an icon they never. Let's stop doing this. We should either use phantom.js to screenshot the blocks, provide a library of re-usable icons, or just don't use icons.
The default icon should be an SVG, and it should also look good :)
Comment #14
darrenwh CreditAttribution: darrenwh as a volunteer and at Investis Digital commentedA few doc blocks missing:
Missing function doc block
Missing function doc block
Missing method doc block
Missing function doc block
Missing function doc block
Missing function doc block
Missing function doc block
Missing function doc block
Comment #15
EclipseGc CreditAttribution: EclipseGc commentedYeah, so fair question. I'm open to contribution here, but here are my basic reasons:
True, they do not, which is why I hard-coded a default that can be overridden (I think... been a while since I wrote this code.) I am NOT opposed to any of your other suggestions. They just weren't on the short list of POC.
Again, agreed, see my previous comments about shortlists and POC :-D
Eclipse