Comments

eloiv created an issue. See original summary.

eloivaque’s picture

Title: compatible with content moderation? » Compatible with content moderation?
jhuhta’s picture

Version: 8.x-1.0 » 8.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new807 bytes

From what I've understood, if a site has Content moderation enabled for a certain node type, then Published (status) value of that node type should not be altered by this module. So no, this is not compatible with Content moderation, but the modules can peacefully co-exist.

I wrote a simple patch to disable the functionality of this module in those cases.

sokru’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

rodrigoaguilera’s picture

Status: Reviewed & tested by the community » Closed (works as designed)

When a site builder enables content moderation for a content type I think is their responsibility to also set the proper permissions for this module.

If this this a big pain point I think the best approach is to hook into the action of enabling content moderation for a content type and remove all permissions that this module sets for that content type informing the user about that automatic change in configuration.

jhuhta’s picture

Category: Feature request » Bug report
Status: Closed (works as designed) » Needs review
StatusFileSize
new590 bytes

Fair enough, let's not do that then.

But the module is not exactly working as designed, so reopening:

When editing a node of a type with Content Moderation enabled and no publish permission given, we get an error: "Notice: Undefined index: #access in path/docroot/modules/contrib/publishcontent/publishcontent.module on line 27". This simple patch should fix that.

rodrigoaguilera’s picture

Status: Needs review » Fixed

Perfect, let's get rid of that notice

lilune’s picture

Hello,

Desactivate Access to Publish Content is your compatibility with content moderation ?

INTRODUCTION :
I needed the moderation state and the publish/unpublish Link & Local Task at the same time.
So, I created a patch for publish content who check the existence of content moderation states.

I use three states for content moderation : draft / submitted / published
If I want unpublish a node with publish content, i want to change it state as a draft.

EXPLANATION :
So, I patched the module like that :

1 - I modified the module page settings (PublishContentSettings.php) to check the existence of content moderation module.
I load the node types who have a initiated "workflow" : workflowBundle
And for each workflowBundle :
- I load all workflow states and dispatch them on two groups : publishStates and unpublishStates
- I add a fieldgroup per node type with three fields :

  • Disable publish content
  • State selection for publish content
  • State selection for unpublish content

2 - I modified the toggleEntityStatus controller function (PublishContentPublishEntity.php) to check existence of content moderation module.
I load the selection of publish and unpublish states depending on node bundle from module settings.
I set the moderation state field with the newState loaded.

3 - I keep the disable function if the checkbox in settings is selected (PublishContentAccess.php)

REMAINS :
I encountered two problems with my patch.
1 - With content moderation, the default revision is unchecked for the draft state. So, for unpublish the publish content, Drupal create a new revision and keep the old revision published.
I test to load the last revision in Publish Content module but it doesn't work, the publish/unpublish link changes well but not the node status.
So, i create a patch for Content Moderation to init draft state with default revision but we have to reinstall the module to make it work.
It works well for me because I'm on development of migration a D7 version but it's not right to do for a production version, people might lose configuration data.
Maybe a form_alter to do ? Or any other ideas ?
2 - I haven't tested with website multilingual, because my actual project doesn't need it. Someone can test that ?

TRANSLATION :
I do the french translation, I extracted the po file with potx module.
Can you integrate that in PublishContent module ? I don't know how to do that.

lilune’s picture

Status: Fixed » Needs review
lilune’s picture

I get an other notice php :

Drupal\views\ResultRow::$node_field_data_langcode dans Drupal\publishcontent\Plugin\views\field\PublishContentNode->render() (ligne 67 de /var/www/html/web/modules/contrib/publishcontent/src/Plugin/views/field/PublishContentNode.php). array(49)

I include the fix with the #6 patch in mine.

I also define another permission than "access administration pages" because a customer doesn't have to configure this module.

webdrips’s picture

StatusFileSize
new12.5 KB

Re-rolling #11 for 1.6, and had to rework some parts of the code. We make some assumptions in the code, but it should work as long as the defaults are used for published and un-published states (published and archived, respectively).

The code should also check if the transitions are allowed, but that gets bypassed right now.