[4.0][Workflow] Remove com_content defaults from workflow code#21641
[4.0][Workflow] Remove com_content defaults from workflow code#21641wilsonge merged 25 commits intojoomla:4.0-devfrom
Conversation
|
This PR is based on #21585 |
|
I thought it looks familiar - so can you close that one please |
|
|
||
| defined('_JEXEC') or die; | ||
|
|
||
| use Joomla\Component\Content\Administrator\Extension\ContentComponent; |
| /** | ||
| * @package Joomla.Administrator | ||
| * @subpackage com_workflow | ||
| * |
There was a problem hiding this comment.
Do we sill have this header? because all other Fields doen't have it. Anyway would be part of the other PR.
There was a problem hiding this comment.
If you're adding a new file (as the GitHub diff seems to imply here) then the header really should be correct from the beginning.
| protected $type = 'Workflowcondition'; | ||
|
|
||
| /** | ||
| * The extension where we're |
There was a problem hiding this comment.
please correct to we are
| @@ -163,22 +204,125 @@ public function filterTransitions($transitions, $pk): array | |||
| */ | |||
| public function countItems(array $items, string $section) | |||
There was a problem hiding this comment.
Will this code be the same for every extension which want's to implement workflow? If yes, please move it either to the CategoriesServiceTrait or the WorkflowServiceTrait. Otherwise every component needs to copy the same code.
There was a problem hiding this comment.
This function exists already in several components in joomla it is/was in the helper class (com_fields-> FieldsHelper, com_contact ->ContactHelper, com_newsfeeds -> NewsfeedsHelper) also it was in the com_content helper and has been moved here by the parent PR #21585
All countItems functions are different, countItems() is already implemented in CategoriesServiceTrait, but can't handle workflow conditions at the moment.
If its ok for you I would create a new PR to migrate all existing function to the component container and try to remove redundancy.
There was a problem hiding this comment.
Actually just look on com_content (or banners) as the others have not being migrated because of some open pull requests which would lead to conflicts. But they will use the CategoriesTrait as the countItems code is the same on all of them, except the table name. No need to copy things over and over again.
All countItems functions are different
What is the difference? I mean all workflow related extensions will have the same code, except column and row names, or not?
There was a problem hiding this comment.
I only skimmed the functions and the looked a bit different that's the reason why I would like to do this a separate PR for all components. I will do it after #21585 is merged.
In the end hopefully all component uses the traits function
There was a problem hiding this comment.
When #20693 gets merged then I will do com_contact and com_newsfeeds. com_banners is already done and com_fields doesn't use categories at all.
There was a problem hiding this comment.
com_workflow also have countItems but this does something different then the other components.
If com_fields doesn't use why we have the function in
administrator/components/com_fields/helpers/fields.php:560
There was a problem hiding this comment.
It is dead code, should be removed as we have now groups.
…ntent # Conflicts: # administrator/components/com_content/Model/FeaturedModel.php # libraries/src/Form/Field/WorkflowconditionField.php # libraries/src/Workflow/WorkflowServiceTrait.php
|
I have tested this item 🔴 unsuccessfully on 76535dc This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/21641. |
Not sure if this is related, does this not happen with the dev-4.0 branch? |
|
it happen with applied Pull Request. |
|
This is unrelated seams to be a problem with state->stage renaming please open a new issue. |
| */ | ||
| protected $extension; | ||
|
|
||
| protected $workflowStage; |
There was a problem hiding this comment.
doc block for this please
|
Not sure about this PR, the idea was to use com_content as fallback like in categories. If we remove this fallback (which is OK with me), we have to add checks and throw an error if extension is missing. |
|
There is ni reason to let com content be the fallback, this only makes it more error prone. I found 3 places where a 3rd party component would fail to use the workflow because com_content was hardcoded or the default fallback. In my opinion the same should be done for categories. |
|
I agree with this PR - we should remove com_content as the default but @bembelimen is correct we should probably hard bail if we can't find an extension. |
|
Sure it should have correct amd useful error messages I will adopt this PR |
| * @throws \InvalidArgumentException when no extension or workflow id is set | ||
| */ | ||
| public function __construct(array $config = array(), MVCFactoryInterface $factory = null, $app = null, $input = null) | ||
| public function __construct($config = array(), MVCFactoryInterface $factory = null, $app = null, $input = null) |
There was a problem hiding this comment.
why remove the array typehint?
| 'index.php?option=' . $this->option . '&view=' . $this->view_list | ||
| . $extensionURL . '&workflow_id=' . $workflow_id, false | ||
| . '&extension=' . $this->extension | ||
| . $extensionURL . '&workflow_id=' . $this->workflowId, false |
There was a problem hiding this comment.
You just deleted $extensionURL
There was a problem hiding this comment.
$extensionURL will be removed
…ntent # Conflicts: # administrator/components/com_workflow/Model/WorkflowModel.php
|
LGTM! |
|
that was a bit too early... I create a new PR fixing 2 things |
…a#21641) * Add component specific workflow conditions. * Archived articles should not be visible when not filtered (=> 3.x behavior) * CS * Fixed missing namespace. * CS * Doc fixes and removed archive state from featured published filter. * Make drone happy * Drone... * cs * Postgresql update, add extension parameter to getCondictions() * Fix condition filter * Remove com_content references in workflow * cs * Use quoteName * Fix workflow edit link * Throw an exception if no extension is set in workflow controller. * Fixed type hint and leftover variable.

This is a cleanup PR to remove com_content references
Summary of Changes
Remove all 'com_content' constants from workflow code.
Testing Instructions
Create, Delete, Edit
for com_content
for com_workflow
Expected result
All works fine