-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[6.1] Plugin for category change when a transition is executed for article #45968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Dileepadari
wants to merge
7
commits into
joomla:6.1-dev
Choose a base branch
from
Dileepadari:6.0-dev
base: 6.1-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+509
−6
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e025b27
Integration of category change when workflow transitions article
Dileepadari 07a2080
encorporated changes based on review
Dileepadari e76f415
spelling issue cleared
Dileepadari 1ce9e8c
sql query corrected
Dileepadari 9a5d18b
indentation and language strings changed
Dileepadari d6abf0c
added filter to category field
Dileepadari 42d3f54
Merge branch 'joomla:6.0-dev' into 6.0-dev
Dileepadari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
administrator/components/com_admin/sql/updates/mysql/6.0.0-2025-08-23.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- | ||
-- Insert the entry of workflow_category plugin to extensions | ||
-- | ||
|
||
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) | ||
SELECT 0, 'plg_workflow_category', 'plugin', 'category', 'workflow', 0, 1, 1, 0, 1, '', '{}', '', -1, 0 | ||
WHERE NOT EXISTS (SELECT * FROM `#__extensions` e WHERE e.`type` = 'plugin' AND e.`element` = 'category' AND e.`folder` = 'workflow' AND e.`client_id` = 0); |
7 changes: 7 additions & 0 deletions
7
administrator/components/com_admin/sql/updates/postgresql/6.0.0-2025-08-23.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- | ||
-- Insert the entry of workflow_category plugin to extensions | ||
-- | ||
|
||
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") | ||
SELECT 0, 'plg_workflow_category', 'plugin', 'category', 'workflow', 0, 1, 1, 0, 1, '', '{}', '', -1, 0 | ||
WHERE NOT EXISTS (SELECT * FROM "#__extensions" e WHERE e."type" = 'plugin' AND e."element" = 'category' AND e."folder" = 'workflow' AND e."client_id" = 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
; Joomla! Project | ||
; (C) 2025 Open Source Matters, Inc. <https://www.joomla.org> | ||
; License GNU General Public License version 2 or later; see LICENSE.txt | ||
; Note : All ini files need to be saved as UTF-8 | ||
|
||
PLG_WORKFLOW_CATEGORY_DESC="A plugin to assign categories during workflow transitions." | ||
PLG_WORKFLOW_CATEGORY_FIELD_CATEGORY_LABEL="Category" | ||
PLG_WORKFLOW_CATEGORY_FIELD_CATEGORY_DESC="Select the category to assign during this transition." | ||
PLG_WORKFLOW_CATEGORY_LABEL="Select Category" | ||
PLG_WORKFLOW_CATEGORY_NO_PRIMARY_KEY="No primary key found for the selected category." | ||
PLG_WORKFLOW_CATEGORY_ERRORS="Encountered errors with %d articles." | ||
PLG_WORKFLOW_CATEGORY_INVALID_TRANSITION="This transition does not contain a valid category setting." | ||
PLG_WORKFLOW_CATEGORY_ARTICLE_NOT_FOUND="Article %d not found for the selected transition." | ||
PLG_WORKFLOW_CATEGORY_ARTICLE_UPDATE_FAILED="Failed to update article ID %d with category ID %d." | ||
PLG_WORKFLOW_CATEGORY_ARTICLE_UPDATE_ERROR="Error updating article ID %d with category." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
; Joomla! Project | ||
; (C) 2025 Open Source Matters, Inc. <https://www.joomla.org> | ||
; License GNU General Public License version 2 or later; see LICENSE.txt | ||
; Note : All ini files need to be saved as UTF-8 | ||
|
||
PLG_WORKFLOW_CATEGORY="Workflow - Category" | ||
PLG_WORKFLOW_CATEGORY_DESC="A plugin to assign categories during workflow transitions." |
33 changes: 33 additions & 0 deletions
33
build/media_source/plg_workflow_category/js/disable-category-batch.es6.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
((document, Joomla) => { | ||
'use strict'; | ||
|
||
const disableCategory = () => { | ||
var dropdown = document.getElementById('toolbar-status-group'); | ||
if (!dropdown) { | ||
return; | ||
} | ||
var batchButton = document.getElementById('status-group-children-batch'); | ||
if (batchButton) { | ||
batchButton.addEventListener('click', function () { | ||
var observer = new MutationObserver(function (mutations, observer) { | ||
var categorySelector = document.getElementById('batch-category-id'); | ||
if (categorySelector) { | ||
categorySelector.disabled = true; | ||
observer.disconnect(); | ||
} | ||
}); | ||
|
||
observer.observe(document.body, {childList: true, subtree: true}); | ||
}); | ||
} | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
disableCategory(); | ||
}); | ||
})(document, Joomla); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extension type="plugin" group="workflow" method="upgrade"> | ||
<name>plg_workflow_category</name> | ||
<author>Joomla! Project</author> | ||
<creationDate>2025-08</creationDate> | ||
<copyright>(C) 2025 Open Source Matters, Inc.</copyright> | ||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license> | ||
<authorEmail>[email protected]</authorEmail> | ||
<authorUrl>www.joomla.org</authorUrl> | ||
<version>6.0.0</version> | ||
<description>PLG_WORKFLOW_CATEGORY_DESC</description> | ||
<namespace path="src">Joomla\Plugin\Workflow\Category</namespace> | ||
<files> | ||
<folder>forms</folder> | ||
<folder>language</folder> | ||
<folder>layouts</folder> | ||
<folder>src</folder> | ||
<folder plugin="category">services</folder> | ||
</files> | ||
<languages> | ||
<language tag="en-GB">language/en-GB/plg_workflow_category.ini</language> | ||
<language tag="en-GB">language/en-GB/plg_workflow_category.sys.ini</language> | ||
</languages> | ||
<config> | ||
<fields name="params"> | ||
<fieldset name="basic"> | ||
<field | ||
name="allowedlist" | ||
type="WorkflowComponentSections" | ||
label="JWORKFLOW_EXTENSION_ALLOWED_LABEL" | ||
description="JWORKFLOW_EXTENSION_ALLOWED_DESCRIPTION" | ||
multiple="multiple" | ||
layout="joomla.form.field.list-fancy-select" | ||
/> | ||
<field | ||
name="forbiddenlist" | ||
type="WorkflowComponentSections" | ||
label="JWORKFLOW_EXTENSION_FORBIDDEN_LABEL" | ||
description="JWORKFLOW_EXTENSION_FORBIDDEN_DESCRIPTION" | ||
multiple="multiple" | ||
layout="joomla.form.field.list-fancy-select" | ||
/> | ||
</fieldset> | ||
</fields> | ||
</config> | ||
</extension> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<form> | ||
<fields name="options"> | ||
<fieldset | ||
name="actions" | ||
label="COM_WORKFLOW_TRANSITION_ACTIONS_LABEL" | ||
> | ||
<field | ||
name="category_id" | ||
type="category" | ||
label="PLG_WORKFLOW_CATEGORY_FIELD_CATEGORY_LABEL" | ||
description="PLG_WORKFLOW_CATEGORY_FIELD_CATEGORY_DESC" | ||
extension="com_content" | ||
filter="integer" | ||
default="" | ||
hide_all="true" | ||
> | ||
<option value="">JOPTION_DO_NOT_USE</option> | ||
</field> | ||
</fieldset> | ||
</fields> | ||
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
/** | ||
* @package Joomla.Plugin | ||
* @subpackage Workflow.category | ||
* | ||
* @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
\defined('_JEXEC') or die; | ||
|
||
use Joomla\CMS\Extension\PluginInterface; | ||
use Joomla\CMS\Factory; | ||
use Joomla\CMS\Plugin\PluginHelper; | ||
use Joomla\DI\Container; | ||
use Joomla\DI\ServiceProviderInterface; | ||
use Joomla\Plugin\Workflow\Category\Extension\Category; | ||
|
||
return new class () implements ServiceProviderInterface { | ||
/** | ||
* Registers the service provider with a DI container. | ||
* | ||
* @param Container $container The DI container. | ||
* | ||
* @return void | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function register(Container $container): void | ||
{ | ||
$container->set( | ||
PluginInterface::class, | ||
function () { | ||
$plugin = new Category( | ||
(array) PluginHelper::getPlugin('workflow', 'category') | ||
); | ||
|
||
$plugin->setApplication(Factory::getApplication()); | ||
|
||
return $plugin; | ||
} | ||
); | ||
} | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.