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\PlaceBlockandDrupal\lb_plus_section_library\Plugin\Sidebar\SectionLibrary, each aSidebarPluginBasedeclared with#[Sidebar(side: 'left', mode: 'edit', tool: '…')], moving the build logic out of the Tool plugins. - Strip
buildLeftSideBar()and the now-unused dependencies from thePlaceBlockandSectionLibraryTool plugins. - JS tool plugins declare
sidebarIdinstead of overridingrequiredSidebar(). - Drop the
-left-sidebarsuffix from the sidebar DOM ids (#place_block,#section_library) across the JS and CSS that reference them. - Route sidebar rebuilds through
NavigationPlusUi::buildSidebarPanel()plus aReplaceCommandon the panel id, inLbPlusRebuildTraitand inNewMedia's file-association settings refresh. - Require
drupal/navigation_plus:^2.3.6for 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
PlaceBlockandSectionLibraryTool 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
Comment #3
tim bozeman commentedComment #5
tim bozeman commented