Problem/Motivation

This would be a great way to add content moderation to a particular content type, or set of bundles:

config:
  actions:
    workflows.workflow.editorial:
      addNodeTypes: [page, article]
      addTaxonomyVocabularies: '*'

Remaining tasks

Implement that with test coverage.

User interface changes

TBD. Should be none.

API changes

TBD.

Data model changes

TBD, but shouldn't be any.

Command icon 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:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Honestly...on second thought, we might not need this to be generic at all. It's probably easier to just expose the plugin-specific actions we need, in the modules that provide them.

phenaproxima’s picture

Title: Add a mechanism for plugins that underlie config entities to expose config actions » Add a config action to add entity types and bundles to a Content Moderation workflow
Status: Active » Needs work
Issue tags: +Needs issue summary update
phenaproxima’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update
phenaproxima’s picture

Issue summary: View changes
phenaproxima’s picture

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

Beautiful! 😍 Zero remarks.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

We're not running this test or scanning this code. See .recipes.gitlab-ci.yml - you need to add the directories to the TEST_DIRECTORIES and CODE_DIRECTORIES - also can you move the test into it's own directory in the content_moderation module so that it is separate.

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community

Nice catch; fixed.

Since this was not a substantive code change, flipping this back to RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I'm wondering something... what happens if a recipe enables content_moderation and uses this plugin in the same recipe - will that work? How does recipe validation work when the action plugin does not exist yet?

alexpott’s picture

Plus we need to convert this to an ConfigAction attribute now

phenaproxima’s picture

Status: Needs work » Needs review

Converted to an attribute!

Regarding #11, this is something we added test coverage for in #3423523: Test that recipe runner fails and rolls back if a recipe tries to use a non-existent config action. The recipe runner will fail because the plugin does not exist. We decided that we don't need to validate it ahead of time; the complexity of doing that outweighs the benefits.

That said, the plugin will exist the moment the providing module is installed by the recipe. I've changed the test to prove this; it now installs Content Moderation and Workflows, and creates the editorial workflow (copied from the Standard editorial_workflow recipe), before using the config action.

alexpott’s picture

Status: Needs review » Needs work

Just one review comment left

phenaproxima’s picture

Status: Needs work » Needs review
alexpott’s picture

Status: Needs review » Needs work

I've added the new plugin directory to the list of things to be scanned and there are some things to fix.

phenaproxima’s picture

Come on, this is no fair.

PHPStan is giving me errors like this one, in AddModeration.php:

32     Method                                                                                
         Drupal\content_moderation\Plugin\ConfigAction\AddModeration::create()                 
         has parameter $configuration with no value type specified in iterable                 
         type array.                                                                           
         💡 See:                                                                               
            https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type  

This is in reference to a completely standard implementation of ContainerFactoryPluginInterface::create().

What exactly am I supposed to do here?? $configuration is unused, and the interface docs (which I can't change) just specify a type hint of array.

This feels like too many pointless hoops to jump through.

alexpott’s picture

@phenaproxima it just goes in the baseline and we forget. I do this that we should comment on the level 9 for core issue to show how disruptive this will be for adding new work to core.

FWIW the phpstan level 9 job has a baseline for you to download with all the errors included - which you can download and commit and then the job will be green.

phenaproxima’s picture

Status: Needs work » Needs review

Fixed what I could, but altered the baseline as well to account for core's non-compliance. Finally we're passing!

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Everything in the last couple of days was just coding standards-related; I don't think I made any substantive changes.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed b4fc09885e2 to 11.x and 20a2005e57e to 10.3.x. Thanks!

  • alexpott committed 20a2005e on 10.3.x
    Issue #3422821 by phenaproxima, alexpott: Add a config action to add...

  • alexpott committed b4fc0988 on 11.x
    Issue #3422821 by phenaproxima, alexpott: Add a config action to add...

  • e3b3e96e committed on patch
    Update recipe 10.3.x patch 20a2005e Issue #3422821 by phenaproxima,...

  • 4856f52a committed on patch
    Update recipe 11.x patch b4fc0988 Issue #3422821 by phenaproxima,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.