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.
Issue fork distributions_recipes-3422821
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
Comment #2
phenaproximaHonestly...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.
Comment #4
phenaproximaComment #5
phenaproximaComment #6
phenaproximaComment #7
phenaproximaThis blocks #3365143-8: Model core's Umami install profile as recipes.
Comment #8
wim leersBeautiful! 😍 Zero remarks.
Comment #9
alexpottWe'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.
Comment #10
phenaproximaNice catch; fixed.
Since this was not a substantive code change, flipping this back to RTBC.
Comment #11
alexpottI'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?
Comment #12
alexpottPlus we need to convert this to an ConfigAction attribute now
Comment #13
phenaproximaConverted 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.
Comment #14
alexpottJust one review comment left
Comment #15
phenaproximaComment #16
alexpottI've added the new plugin directory to the list of things to be scanned and there are some things to fix.
Comment #17
phenaproximaCome on, this is no fair.
PHPStan is giving me errors like this one, in
AddModeration.php: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.
Comment #18
alexpott@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.
Comment #19
phenaproximaFixed what I could, but altered the baseline as well to account for core's non-compliance. Finally we're passing!
Comment #20
phenaproximaEverything in the last couple of days was just coding standards-related; I don't think I made any substantive changes.
Comment #21
alexpottCommitted and pushed b4fc09885e2 to 11.x and 20a2005e57e to 10.3.x. Thanks!