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
Follow up to #2957425: Allow the inline creation of non-reusable Custom Blocks in the layout builder
This is what the current Layout Builder UI looks like for creating inline blocks:
This isn't what's in the mockups.
Proposed resolution
Make it look more like the mockups: https://projects.invisionapp.com/boards/KH3EPJMFNWR4Z
This is how it appears, as of patch #39:
Remaining tasks
Do it.
User interface changes
Yes.
API changes
Dunno yet.
Data model changes
Dear Cthulhu, please no.
Comment | File | Size | Author |
---|---|---|---|
#39 | 2968500-39-after.png | 132.92 KB | phenaproxima |
#39 | interdiff-2968500-35-39.txt | 4.63 KB | phenaproxima |
#39 | 2968500-39.patch | 17.88 KB | phenaproxima |
#35 | interdiff-2968500-29-35.txt | 2.16 KB | bendeguz.csirmaz |
#35 | 2968500-35.patch | 17.68 KB | bendeguz.csirmaz |
Comments
Comment #2
tedbowComment #3
tedbowTaking a try at this
Comment #4
tedbowHere is first try.
It adds a "Add new block" button link to the top of the block list.
Because this #2948064: Layout Builder should support inline creation of Custom Blocks using entity serialization isn't done
/admin/structure/block/block-content
Comment #6
tedbowFixing test failure. Needed to check if
block_content_type
is available.Comment #7
tedbowRedoing patch against #2948064-43: Layout Builder should support inline creation of Custom Blocks using entity serialization
Comment #9
tedbowtestAddWorkFlow()
to test the workflow when you have 0, 1 or > 1 block types. Could have added this totestInlineBlocks()
but I think having it as its own test is more clear.Comment #10
tim.plunkettHow does this relate to #2957425: Allow the inline creation of non-reusable Custom Blocks in the layout builder with all the changes in the last 2 months?
Comment #11
tedbowUpdating and rerolling
Comment #12
tedbowYay, tests pass! 🎉
Postponing on #2957425: Allow the inline creation of non-reusable Custom Blocks in the layout builder.
That patch is already big enough I would rather not roll it in there.
Comment #14
tedbowAfter #2957425: Allow the inline creation of non-reusable Custom Blocks in the layout builder this will need a re-roll
Comment #15
samuel.mortensonGoing to work on a re-roll and CSS to match the mockup.
Comment #16
samuel.mortensonHere's the re-roll and button label change to match mockup. Just CSS and a back button left.
Comment #17
tedbow@samuel.mortenson thanks for getting this rolling again.
I know this is the label in the mock-up but will this be problem because in the UI "content" usually refers to node entities.
It seems this would be implying you are creating a new node.
I could see a contrib module in the future or core adding the ability to add nodes directly in the layout builder.
Comment #18
samuel.mortensonThis patch adds a "Back" button from the block listing, and lots of styling to make this flow feel unique compared to other blocks. The styling and functionality is ready for review.
I think #17 needs UX review.
Comment #19
AaronMcHaleAgree with #17, although can’t think of a better name myself.
@samuel.mortenson thanks for picking this up, hopefully we can get this RTBC and committed in 8.7
Comment #20
tedbowRe #17
Instead of "Create new Content" why not just "Create a new block" and "Create a custom block"?
label_singular
for ourblock_content
entity type. This is part of our API presumably this how contrib modules are told to refer to them in the UI.If don't respect that then we are going to have different modules referring blocks(or other entity types) by different labels. That would be very confusing to end users because they will not know that when they see "Add custom block" in 1 place "Add [our special label]" in another place that they can expect to be able to add the same types of things.
i.e. If you have 3 custom block types for a site, Basic, Video, and Gallery when a user sees "Add custom block" in layout builder or the custom block library or Contrib module X or anywhere else on the site they can expect to see these types of things. Otherwise they have to remember for all the different places in the site where they see "Add [special label1]" that is actually the same type thing as "Add [special label2]"
So if we use "Add custom block" a user seeing that in any location on their site can say to themselves "Oh yeah I have seen that before that will allow me to add a Video or Gallery block". And they can likely infer that if they have have not yet clicked the link in particular location if they have clicked similar link provided by another module.
Wordpress's new Guttenberg
Magento
Maybe others?
Comment #21
AaronMcHale@tedbow - I totally agree with you regarding the consistency of naming, my only concern is that users also associate custom blocks with being reusable and available anywhere on the site, the problem here is the blocks being added aren't reusable so that could also result in confusion for some users, for example "I added this custom block through Layout Builder, why is it not available anywhere else on the site, or even in any other Layout?".
I now have two competing thoughts in my head though:
The first is that in some ways it might almost be better for us to have that custom name for Custom Blocks since because they aren't reusable the end user (e.g. content editor, not a developer) doesn't need to know that technically they are just the same as any other block except they can't be reused.
My second thought is given that as soon as they click the "Add [whatever]" button it gives them a list of custom block types to choose from they might be confused as to what this list means, where it came from and how they can change it, especially if they have more than just Basic Block.
Unfortunately those two conflicting thoughts mean I'm not sure what the best way forward is, at the moment there doesn't seem to be a clear way forward that doesn't introduce at least some degree of possible confusion, but of course we need to do something so maybe there's a nice middle ground we can find somewhere.
Comment #22
samuel.mortensonComment #23
xjmCan we get a "before" screenshot so we can compare it to what's in the mockups?
Comment #24
phenaproximaDone.
Comment #25
bendeguz.csirmaz CreditAttribution: bendeguz.csirmaz at Cheppers commentedI tested it, and it works.
Comment #27
tim.plunkettComment #28
lauriiiThe most recent patch doesn't apply anymore
Comment #29
tedbowJust a reroll
StringTranslationTrait
was now only$build['#title'] = $this->t('Choose a block');
Comment #30
lauriiiWe should remove the element type from the selector. This should be only
#drupal-off-canvas .inline-block-create-button
.Could we add class for the links in the list? Something like
.inline-block-list__item
.What is the reason for providing the transition? I tried to look at the Seven style guide but it doesn't mention anything about using transitions.
Comment #31
bendeguz.csirmaz CreditAttribution: bendeguz.csirmaz at Cheppers commentedIt turns out removing the anchor element from the create button's selector will make the css specificity too low, and it'll get overridden.
I decided to add a class to the container, and use that to combat this issue.
The other option, as @huzooka suggested, is to add a modifier class, and use that.
Comment #32
phenaproximaKicking to review.
Comment #34
lauriiiWe should always use a single class as a selector. Off-canvas is a special case where we add the id selector behind the class selector to increase the weight.
Comment #35
bendeguz.csirmaz CreditAttribution: bendeguz.csirmaz at Cheppers commentedFixed!
My previous comment was a false alarm.
I accidentally used the patch from #2952390: Off-canvas styles override CKEditor's reset and theme, thanks @lauriii for pointing that out.
Comment #36
bendeguz.csirmaz CreditAttribution: bendeguz.csirmaz at Cheppers commentedComment #37
lauriiiThanks for making the changes @bendeguz.csirmaz! The front end parts of the patch look good for me now.
Comment #38
webchickMy first reactions upon @phenaproxima showing this to me is that:
1) Yay, that's a WAY better UX!
but
2) Yikes, we can't call that "Create new content" because we already say that somewhere else and mean something entirely different. (This was brought up above as well.)
Apparently the team already went through a bike-shedding exercise and ended up at "Create custom block" (since this is the existing entity label), which sounds much better to me. The only potential weirdness there is we call other things custom blocks that are re-usable, and this one is for the page we're on only. So we should probably open a follow-up to discuss how to make this clearer to people. But it doesn't need to block this patch, which is pretty awesome on its own.
Since this is just a label change, feel free to move back to RTBC once this is done.
Comment #39
phenaproximaChanged "Create new content" to "Create custom block" and adjusted the tests. Also attaching an "after" screenshot for committer happiness.
Comment #40
phenaproximaFound a typo that is fixable on commit:
Should be "...goes directly to block add form."
Comment #41
phenaproximaFixing the issue title.
Comment #42
phenaproximaGreen is my favorite color. Returning to RTBC as per #38.
Comment #43
webchickAwesome!!
Committed and pushed to 8.7.x and backported to 8.6.x. Thanks!