Problem/Motivation

From @andrewmacpherson's original extensive issue summary which can be seen here

We're in deeply experimental territory here - there isn't a well-established, reliable pattern we can just copy to make the current layout builder accessible. Essentially, we're making stuff up in a hurry, for a novel UI, with limited opportunity for design validation. There's no guarantee that users are going to understand it, or find it easy to use.

Proposed resolution

Provide a "Layout Overview"(better wording?) link at the top of the Layout Builder
This link would open up an overview in the off-canvas dialog that would allow the user to perform all the operations they can in the current live preview version.
Layout overview in off-canvas dialog

All of the actions currently in the Layout Builder are performed in the off-canvas dialog either through selecting items in a list(adding blocks and sections) or interacting with a form. The only exception to this is dragging and dropping blocks but #2995689: Allow reordering blocks without a pointer device would provide a way to do this via a form.

The overview in the off-canvas would allow all users to share most of the UI's for taking actions on the Layout but provide a more standard way to access those actions than the current live preview.

After each action the users take via the overview they be would shown the overview again at the end of the action. This would allow a user to take multiple actions via the overview without having to open the overview for each action.

Remaining tasks

User interface changes

A new layout overview in the off-canvas dialog

API changes

None

Data model changes

None

Release notes snippet

@todo

Issue fork drupal-3019490

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andrewmacpherson created an issue. See original summary.

andrewmacpherson’s picture

Issue summary: View changes

Moved this from [#12853731-21], almost verbatim.

TODO:
I have some notes about questions asked in Slack and elsewhere. I'll add summaries of those soon.
Use the issue summary template.

tim.plunkett’s picture

Assigned: Unassigned » tim.plunkett
Status: Active » Postponed

Postponing on #2995689: Allow reordering blocks without a pointer device for now.
I have some non-functional code but I spent a good chunk of time on it. Gotta dig it up.

tedbow’s picture

Status: Postponed » Needs review
StatusFileSize
new18.81 KB

Here is an idea that I chatted with @andrewmacpherson about.

  1. Provides a "Layout Overview" link at the top of the Layout Builder
  2. This opens the off-canvas dialog with all the of Sections/Regions/Blocks listed.
  3. It has all(I think) of the actions available via links on the Sections/Regions/Blocks.
  4. All of the action links from the overview remain in the off-canvas
  5. When the action is finish, Block added, Section removed, etc. the overview is reopened
  6. So multiple actions can be performed and the overview remains open
  7. For moving blocks I have a @todo for #2995689: Allow reordering blocks without a pointer device. Once that is done each block would have a "Move block" action.

This started from the code @tim.plunkett mentioned in #3 but that was a totally separate UI.

@andrewmacpherson was interested in having this overview be a sortable list but I thought it might be to cluttered and if you had a very complicated layout moving a block could be confusing I think.

tedbow’s picture

StatusFileSize
new9.68 KB
new20.5 KB

This patch

  1. Fixes problem with single item dropbottons. This should be fixed in the off-canvas reset. Very unsure about the actual CSS here
  2. Change the "remove block" and "configure block" links to just "Remove" and "configure"
  3. Change the region "Add block" link to an operation
  4. fixes a bug where all the blocks should in 1 region for section even if in different regions

Here a 2 minute demo video: https://youtu.be/Jv7RgxiDW1U

Status: Needs review » Needs work

The last submitted patch, 5: 3019490-5.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new20.5 KB
new742 bytes

Just fixing bug in #5

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned

I like where this is heading. Unassigning for now as clearly others are working on it :D

kristen pol’s picture

Thanks for the patch. I found some minor things below. I will try to test this.

  1. +++ b/core/modules/layout_builder/css/layout-builder.css
    @@ -114,3 +114,31 @@
    +@todo Open an issue to fix .dropbutton-single in off-canvas reset
    

    Nitpick: * and space before @todo and add period.

  2. +++ b/core/modules/layout_builder/css/layout-builder.css
    @@ -114,3 +114,31 @@
    +#drupal-off-canvas .layout-overview td .dropbutton-single  .dropbutton-widget .dropbutton {
    

    Nitpick: Change double space to single space before .dropbutton-widget.

  3. +++ b/core/modules/layout_builder/css/layout-builder.css
    @@ -114,3 +114,31 @@
    +#drupal-off-canvas .layout-overview td .dropbutton-single  .dropbutton-widget {
    

    Same as above.

  4. +++ b/core/modules/layout_builder/css/layout-builder.css
    @@ -114,3 +114,31 @@
    +#drupal-off-canvas .layout-overview td .dropbutton-single  .dropbutton-widget .dropbutton a {
    

    Same as above.

  5. +++ b/core/modules/layout_builder/css/layout-builder.css
    @@ -114,3 +114,31 @@
    +#drupal-off-canvas .layout-overview td .dropbutton-single  .dropbutton-widget .dropbutton .dropbutton-action {
    
    +++ b/core/modules/layout_builder/src/Controller/ChooseBlockController.php
    @@ -22,6 +22,7 @@ class ChooseBlockController implements ContainerInjectionInterface {
       use AjaxHelperTrait;
       use LayoutBuilderContextTrait;
       use StringTranslationTrait;
    +  use LayoutRebuildTrait;
    

    Nitpick: Change to alphabetical.

  6. +++ b/core/modules/layout_builder/src/Controller/ChooseBlockController.php
    @@ -22,6 +22,7 @@ class ChooseBlockController implements ContainerInjectionInterface {
       use AjaxHelperTrait;
       use LayoutBuilderContextTrait;
       use StringTranslationTrait;
    +  use LayoutRebuildTrait;
    

    Same as above.

  7. +++ b/core/modules/layout_builder/src/Controller/ChooseSectionController.php
    @@ -20,6 +20,7 @@ class ChooseSectionController implements ContainerInjectionInterface {
       use AjaxHelperTrait;
       use StringTranslationTrait;
    +  use LayoutRebuildTrait;
    

    Same as above.

  8. +++ b/core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php
    --- /dev/null
    +++ b/core/modules/layout_builder/src/Controller/OverViewController.php
    

    Nitpick: OverView => Overview?

  9. +++ b/core/modules/layout_builder/src/Controller/OverViewController.php
    @@ -0,0 +1,333 @@
    + */
    +class OverViewController {
    

    Nitpick: OverView => Overview?

  10. +++ b/core/modules/layout_builder/src/Controller/OverViewController.php
    @@ -0,0 +1,333 @@
    +  use LayoutRebuildTrait;
    +
    +
    

    Nitpick: Extra line.

  11. +++ b/core/modules/layout_builder/src/Controller/OverViewController.php
    @@ -0,0 +1,333 @@
    +    for ($i = 0; $i < count($section_storage); $i++) {
    +      $table["add-section-$i"] = $this->buildAddSectionLink($section_storage, $i);
    +      $table += $this->buildAdministrativeSection($section_storage, $i);
    +    }
    +    $table["add-section-$i"] = $this->buildAddSectionLink($section_storage, $i);
    

    Nitpick: Use $this->sectionStorage instead of $section_storage?

  12. +++ b/core/modules/layout_builder/src/Controller/OverViewController.php
    @@ -0,0 +1,333 @@
    +    /*
    +    $operations['move'] = [
    +      'title' => $this->t('Move'),
    +      'url' => Url::fromRoute('layout_builder.move_block_form', $route_parameters, $this->getOverviewOptions(TRUE)),
    +      'attributes' => [
    +        'class' => ['use-ajax', 'configure-block'],
    +        'data-dialog-type' => 'dialog',
    +        'data-dialog-renderer' => 'off_canvas',
    +      ],
    +    ];
    +    */
    

    Nitpick: Remove commented out code for now and just leave the @todo?

  13. +++ b/core/modules/layout_builder/src/Controller/OverViewController.php
    @@ -0,0 +1,333 @@
    +    $storage_type = $section_storage->getStorageType();
    +    $storage_id = $section_storage->getStorageId();
    

    Nitpick: Not sure if these need to be defined as they are only used once.

  14. +++ b/core/modules/layout_builder/src/Controller/OverViewController.php
    @@ -0,0 +1,333 @@
    +    }
    +
    +
    +    return $build;
    

    Nitpick: Extra empty line.

  15. +++ b/core/modules/layout_builder/src/Controller/OverViewController.php
    @@ -0,0 +1,333 @@
    +    $storage_type = $section_storage->getStorageType();
    

    This isn't used in this function.

  16. +++ b/core/modules/layout_builder/src/Controller/OverViewController.php
    @@ -0,0 +1,333 @@
    +    $storage_id = $section_storage->getStorageId();
    

    Same as above.

kristen pol’s picture

I tested the patch in #7 as follows:

  1. Enabled layout builder modules
  2. Configured layout builder on page content type
  3. Go to layout page
  4. Clicked "Layout overview" link
  5. Used the overview form by adding new section and one block per section
  6. Clicked the "X" in the overview form
  7. Clicked "Save Layout"
  8. The regular layout tool and the page had the blocks that were added to the new section

I think the main issue I noticed was that the right side of the overview form was slightly cut off. Also, I don't think it's obvious what "Layout overview" means and what it is intended for. Clicking on it is harmless enough though. Visually the "Layout overview" link is merged with the "Add Section" box. I see that it has the same styling as the "Configure section" link but "Configure section" is for that particular box whereas "Layout overview" is for the entire layout so it seems like it should be separated more from the boxes somehow. I don't have suggestions to make this better other than perhaps add some space below it for now.

I'll mark "Needs work" in case any of the items in comment #9 should be addressed, and to fix the slight alignment issue.

tim.plunkett’s picture

Untagging as the parent issue has the tag. Still needs an IS update

tedbow’s picture

Status: Needs work » Needs review
Issue tags: -Accessibility +accessibility, +Needs tests
StatusFileSize
new8.81 KB
new22.17 KB

@Kristen Pol thanks for the review
re #9

1. Made this a single line comment as I see in other css @todo's in core. We either need to remove this or add the follow up before this issue is done
2-10 fixed
11. Actually I don't think we need $this->sectionStorage at all. removing.
12. Leaving todo
13. removing
14-16. fixed

re #10

I think the main issue I noticed was that the right side of the overview form was slightly cut off.

I fixed this by setting the width the off-canvas dialog to be wider by 50px.

@todo resolve the style issue mentioned about the link.

Status: Needs review » Needs work

The last submitted patch, 12: 3019490-12.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new693 bytes
new22.17 KB
+++ b/core/modules/layout_builder/layout_builder.routing.yml
@@ -1,3 +1,15 @@
+    _controller: '\Drupal\layout_builder\Controller\OverViewController::overview'

I forgot to change the case of the classname here.

tedbow’s picture

Title: Alternative table-based UI for layout builder » Provide a Layout Override dialog that allows performing all actions in a text/form based method
Issue summary: View changes
Related issues: +#2995689: Allow reordering blocks without a pointer device
StatusFileSize
new133.17 KB

I am updating the Issue Summary to reflect the current approach

tedbow’s picture

Issue summary: View changes
tedbow’s picture

Title: Provide a Layout Override dialog that allows performing all actions in a text/form based method » Provide a Layout Overview dialog that allows performing all actions in a text/form based method
StatusFileSize
new1.13 KB
new22.27 KB

fixing the title and some minor css changes to "Add section which was pulling CSS from preview area. Will still need more css fixes

tim.plunkett’s picture

Status: Needs review » Needs work
Issue tags: -accessibility (duplicate tag) +Accessibility

Fixing tag
NW for tests and IS update

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

tim.plunkett’s picture

Category: Plan » Task
bnjmnm’s picture

Status: Needs work » Needs review
StatusFileSize
new26 KB
new44.78 KB

Rerolled, added move to the block options, added tests that included moving some methods from MoveBlockFormTest into a trait + fixed a few code standards nits.

yogeshmpawar’s picture

Assigned: Unassigned » yogeshmpawar
yogeshmpawar’s picture

Assigned: yogeshmpawar » Unassigned
StatusFileSize
new44.68 KB
new577 bytes

Resolved two coding standard issues & added an interdiff.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

tim.plunkett’s picture

Status: Needs review » Needs work

Marking NW for the issue summary and tests.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

aleksip’s picture

StatusFileSize
new44.83 KB
new8.65 KB

Reroll

ankithashetty’s picture

StatusFileSize
new45.25 KB
new3.13 KB

Fixed custom command failures in #29. Retaining that status as 'Needs work' to address #25, thanks!

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.