joomla-cms
joomla-cms copied to clipboard
[5.2] [GSoC 21] Feature - Implement Workflows for com_modules
Project Repo PR: https://github.com/joomla-projects/gsoc21_core-enhancements/pull/10
Summary of Changes
Access
- The corresponding access.xml actions have been added.
Articles Model
- The
getListQuery()method joins the old query with workflow_associations to also consider the workflow stages that belong tocom_content.articlesonly.
SQL Changes:
- The following have been added to the Database Tables:
- 1 new workflow:
COM_WORKFLOW_BASIC_WORKFLOW_MODULES - 1 new stage:
COM_WORKFLOW_BASIC_STAGE - 3 new transitions: Publish, Unpublish, and Trash
- 1 new workflow:
- Workflow Associations have been created for all existing modules via an update script / a query during Installation.
Introduce a new Backend Menu Item
- A new menu item for Modules: Workflows to execute CRUD for
com_modules
Option to Enable Workflow Integration
- This can be toggled from Global Configuration
Searchtools Filtering
- Option to filter modules via their stage
ModulesComponent.php
- Added necessary functions that are used by Workflow Plugins (Workflows, Featuring and Publishing)
Module Model
- The get query now takes into account the workflow stage associated with each module.
- Added Workflow before and after Save events
- Added a function to get the initial stage for a module (default workflow and default stage)
- Added a query to create workflow association while duplicating modules
- Added a function that prepares the workflow field
Modules Model
- Join the query with workflow associations
- Add a filterForm function to filter based on workflow stage
Modules Template:
- Added workflows column to the table
- This column is conditionally rendered when workflows are enabled
- Added workflows field to default batch body
The Flow:
- When creating new modules you have to select a workflow and when you save, the default stage under this workflow_id is set as the initial stage of the module.
- When editing exiting modules, the workflow transition field is shown instead of the workflow_id field, which works similarly to com_content.
New Modules: Select Workflow
(Permanent similar to workflow assignment for com_content)

Edit Existing Modules: Transition Field

Testing Instructions
After a fresh install: 1, Go to Modules (Site or Admin) -> Options -> Integrations -> Enable Workflows 2. Test the transitions in modules view 3. Test CRUD for workflows, stages, and transitions in Modules: Workflows 4. Test Batch and Duplicate
Expected result AFTER applying this Pull Request
Workflows are integrated into Modules and work as expected.
https://user-images.githubusercontent.com/53610833/129226377-79bddb17-7968-4bf7-9599-f206ff9853e2.mp4
Documentation Changes Required
Possibly yes. Something on the lines of https://docs.joomla.org/Publishing_Workflow_Implementation#Implement_com_workflow_into_your_extension
Mentors
@chmst @nibra @bembelimen (And special thanks to @richard67)
Thanks for this PR.
Will test once 4,0 is out of the way
This cannot be merged until the the PHP level issue with heredoc is fixed.
I have tested this item :red_circle: unsuccessfully on ab406a35ea8aa6087d6ef6f476d2dd6a68efc064
Not compatible with PHP 7.2 - see: https://github.com/joomla/joomla-cms/pull/35101/files#r775081165
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35101.
Oops, I rebased to 4.2-dev instead of 4.1 I'll revert and fix this. Also, sorry for the review requests. I'm unable to remove them from my end.
Oops, I rebased to 4.2-dev instead of 4.1 I'll revert and fix this. Also, sorry for the review requests. I'm unable to remove them from my end.
@YatharthVyas You can remove review requests after having reverted the rebase (or rebased back) and then using the cog icon near the reviewers list on github.
Update: I have changed the base branch after discussing this with my mentors to 4.2-dev since being a new feature, this wont be going into 4.1
@richard67 Unfortunately, I'm still unable to remove the review requests. I dont know if I'm doing something wrong but the cog icon isnt visible for me
This pull requests has been automatically converted to the PSR-12 coding standard.
This pull request has been automatically rebased to 5.0-dev.
This pull request has been automatically rebased to 5.1-dev.
This pull request has been automatically rebased to 5.2-dev.
I have tested this item :red_circle: unsuccessfully on 1c3ad7682e7cd2e18a2c2006c5c741c9bf1f601f
Applying the patch gave me a 500 error after saving and closing the module options. I am doing this on a live stream one of my viewers said "soo it look like the patch is out of date and needs to be updated before it's ready to test again."
Layout default_batch_footer not found. Call Stack
Function Location
1 () JROOT/libraries/src/MVC/View/HtmlView.php:425 2 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/administrator/components/com_modules/tmpl/modules/default.php:284 3 include() JROOT/libraries/src/MVC/View/HtmlView.php:416 4 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:204
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/35101.
@cybersalt At the end of the page you find this information:
This means that the pull request can not be test until the conflicts are solved and the failed test is expected why it should be changed to "not tested" at the issue tracker.
This pull request has been automatically rebased to 5.3-dev.
This pull request has been automatically rebased to 6.0-dev.
This pull request has been automatically rebased to 6.1-dev.