Problem/Motivation
The API provided by the Workspace module is very useful for various kinds of tasks, for example node and comment previews and even content moderation could be written on top of a "micro workspace" concept.
Proposed resolution
Given that not every Drupal site needs the full-blown UI for managing workspaces, let's split it into a separate module, just like Views does.
Remaining tasks
Review.
User interface changes
The workspaces UI will be provided in a separate module.
API changes
Nope.
Data model changes
Nope.
Release notes snippet
A new workspaces_ui module has been added which providess workspace module's routes and toolbar integration. This is to allow for alternative user interface implementations in core or contrib.
Sites already using workspaces will have workspaces_ui enabled in an update.
Issue fork drupal-2972622
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:
- 2972622-split-workspaces_ui
changes, plain diff MR !10147
Comments
Comment #2
timmillwoodInstead of having two modules "Workspace" and "Workspace UI", how about moving the core workspace functionality into core, and leaving just the UI in Workspace module? Similar to how all the off canvas parts of Settings Tray module were moved from the module to core? This would make #2972623: Rewrite the node preview functionality on top of workspaces a lot easier to implement.
Comment #3
catchThanks for opening this. I've been wondering whether eventually content_moderation should essentially be an alternative UI using workspaces internally (since it would make issues like #2949412: Nested paragraphs automatically publish, even if the parent is a draft much easier to deal with).
Comment #5
amateescu commentedFix component following module rename.
Comment #15
amateescu commentedWhile #2 is a desirable goal, I think the module needs to gain more real-world usage before we can consider moving it to be core API. For now, splitting the UI bits is an easier lift.
Comment #17
amateescu commentedComment #18
amateescu commentedComment #19
catchWe should open a follow-up to move more of the UI scaffolding code over but I like doing the absolute minimum here.
I added a change record. Tagging for release highlights too.
Looks like just the hook_help generic test coverage is the problem now?
Comment #20
catchAdded the release note.
Comment #21
amateescu commentedYep, and I've already spent way too many hours last night trying to figure out what the problem is. The hook is there, I can access the help page in the UI on my local, but inside the test this line from
\Drupal\help\Controller\HelpController::helpPage()returns FALSE:Comment #22
catchDid you try using a procedural hook_help() implementation?
Comment #23
amateescu commentedYup, I only moved it to an OO hook hoping it would fix stuff, but it didn't.
Comment #24
amateescu commentedOpened the followup.
Comment #25
catchComment #26
gábor hojtsyAs a core product manager I think this makes sense. It allows us more flexibility in the future to possibly remove the big UI for example from core if we think its not an 80% use case even if content moderation or node preview is still reliant on the API.
Only minor note is the description of the original module now does not reflect what it does? The module does not provide full site previews after this MR.
This is minor IMHO but would be still useful to fix to make it easier to understand what's the relation between the two modules. But leaving needs review for more reviews as appropriate.
Comment #27
catchChange to maybe this?
Comment #28
amateescu commentedThe suggestion from #27 sounds great, pushed it to the MR.
Comment #29
fabianx commentedRTBC
The approach makes sense to me. It feels a little bit weird to have workspace tests need to enable workspaces_ui but for integration tests the UI is obviously needed.
But one curious observation:
Why don’t I see removals of the new Hooks added to workspaces_ui to support toolbar, etc.
I had expected a big removal from workspaces.module, but there is nothing.
Maybe that is related to the hook_help problem?
Comment #32
amateescu commentedThat was because of #3483599: Convert all procedural hook implementations to Hook classes, fixed in https://git.drupalcode.org/project/drupal/-/merge_requests/10147/diffs?c...
Comment #36
catchThanks this looks good, nice catch on the moved toolbar hook implementation.
Committed/pushed to 11.x and cherry-picked to 11.1.x, thanks!