Problem/Motivation
Would like the ability to filter by section versus template in the import from section library screen.
Also want to improve code quality and compatibility with both layout builder modal and layout builder iframe modal.

Steps to reproduce
Proposed resolution
- Click "Import section from Library" and see a new dropdown to filter by section versus template
- Install either layout builder modal or layout builder iframe modal and be able to import from the library
Note: when using layout builder iframe modal, it needs to be configured to add itself to the section library routes. On /admin/config/content/layout_builder_iframe_modal add the following to the Custom routes textarea:
- section_library.add_section_to_library
- section_library.add_template_to_library
- section_library.choose_template_from_library
- section_library.import_section_from_library
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | section_library_filter-3195007-20.patch | 185.19 KB | jastraat |
| #12 | section_library_type_dropdown-3195007-12.patch | 26.41 KB | jastraat |
| #4 | section_library_type_dropdown-3195007-4.patch | 19.44 KB | jastraat |
| Screen Shot 2021-01-27 at 12.19.43 PM.png | 134.21 KB | aaronchristian |
Issue fork section_library-3195007
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
Comment #3
aaronchristian commentedComment #4
jastraat commentedI'm attaching a patch that integrates the MR's changes with the latest dev of section_library. Unfortunately I could not make changes to the MR directly. This also does not resolve the two last issues.
Comment #5
jastraat commentedUpdated patch that pre-filters template type based on the import link clicked. Still haven't figured out how to get the ajax modal to close after adding a template.
Comment #6
jastraat commentedAnd finally figured out the dialog closing issue. This latest patch addresses both of the outstanding issues mentioned in #3.
I also fixed the failing test.
Comment #7
jastraat commentedSorry - that earlier patch included some changes from another section_library patch I have applied.
Here's a clean one.
Comment #8
aaronchristian commentedThanks @jastraat for picking this up so long after the creation of this issue!
I did try to test the patch but received some errors in doing so;
Wondering if maybe there is still some of the other patch being caught up in the mix here.
I also tried to apply patch #5 but got the same error.
Going to mark this as "Needs work" for the time being.
If you manage to sort things out feel free to post back and I'll give it another test.
Thanks again!!!
Comment #9
jastraat commentedHey @AaronChristian thank you for testing! Just to make sure, did you fully clear the Drupal cache after applying the patch? This injects a new service to check for layout_builder_modal.
Comment #10
dmundra@jastraat would the patch benefit from a update hook to clear the cache?
Comment #11
jastraat commentedAdding a patch with a post-update hook to automatically clear the cache and pick up the updated form dependencies.
Comment #12
jastraat commentedI'm afraid my last few patches were corrupted. Here's a new patch with the changes from patch 7 + a post update hook to clear the cache and prevent the error @AaronChristian saw.
Comment #16
jastraat commentedComment #17
jastraat commentedComment #18
jastraat commentedComment #19
jastraat commentedComment #20
jastraat commentedI adjusted the scope of this issue so that the solution could be supported by layout builder with no modal, layout builder modal, and layout builder iframe modal.
The MR now adds a select to allow filtering by "Section" versus "Template", removes the sass directory since CSS now supports nesting and all the node packages were really out of date, improves the module's compatibility with layout builder iframe modal, removes the dependency on jquery, and fixes a few warning errors from the pipeline. Also refactored to take into account the fixes from #3217647: Adding stuff to library doesn't close dialog if dialog opens in popup.
It also addresses the problem with access checking and the core navigation module outlined in #3241715: Access check problems on add_to_template link and #3480604: Error with core navigation module.
Please test creating and importing templates with no modal modules, with layout builder modal, and with layout builder iframe modal. Also test enabling the core navigation module and visiting /admin/config/user-interface/navigation-block
Please confirm that you can filter by section versus template when choosing a template to import and that it combines with the label search that was already there.
Comment #21
terracoders commentedTested as working per all criteria established in comment #20. Patch is working great!
Comment #22
mahmoud-zayed commentedLooks good to me, css will be much simpler!
Comment #24
jastraat commented