Problem/Motivation

navigation_plus 2.3 introduced a dedicated Sidebar plugin type (the #[Sidebar] attribute, SidebarPluginBase, and NavigationPlusUi::buildSidebarPanel()). LB+ predates it: the Place Block and Section Library left-rail palettes are built as tool-owned markup by a buildLeftSideBar() method on each Tool plugin, addressed by hardcoded #place_block-left-sidebar / #section_library-left-sidebar DOM ids, and refreshed with bespoke HtmlCommand AJAX logic.

This couples each palette to its tool and duplicates wiring that navigation_plus now provides. The palettes should be first-class Sidebar plugins bound to their tool and to Edit Mode.

Proposed resolution

Migrate both sidebars to the navigation_plus Sidebar plugin API:

  • Add Drupal\lb_plus\Plugin\Sidebar\PlaceBlock and Drupal\lb_plus_section_library\Plugin\Sidebar\SectionLibrary, each a SidebarPluginBase declared with #[Sidebar(side: 'left', mode: 'edit', tool: '…')], moving the build logic out of the Tool plugins.
  • Strip buildLeftSideBar() and the now-unused dependencies from the PlaceBlock and SectionLibrary Tool plugins.
  • JS tool plugins declare sidebarId instead of overriding requiredSidebar().
  • Drop the -left-sidebar suffix from the sidebar DOM ids (#place_block, #section_library) across the JS and CSS that reference them.
  • Route sidebar rebuilds through NavigationPlusUi::buildSidebarPanel() plus a ReplaceCommand on the panel id, in LbPlusRebuildTrait and in NewMedia's file-association settings refresh.
  • Require drupal/navigation_plus:^2.3.6 for the Sidebar API.

Because the Sidebar plugins now evaluate applies() on more routes (including core Layout Builder/admin routes), two guards come along: lbPlusToolApplies() returns early for non-fieldable (config) entities, and DropZones resolves the layout block from the section storage's nested context.

API changes

  • The PlaceBlock and SectionLibrary Tool plugins no longer build sidebars; buildLeftSideBar() is removed from both.
  • LbPlusRebuildTrait::rebuildLeftSidebar() now takes a sidebar plugin id (equal to its DOM id) instead of a tool id.
  • New dependency: drupal/navigation_plus:^2.3.6.

Comments

tim bozeman created an issue. See original summary.

  • tim bozeman committed 89181d19 on 3.6.x
    task: #3595007 Move tool sidebars to navigation_plus Sidebar plugins
    
    By...
tim bozeman’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.