Let WorkflowManager and WorkflowGroupManager call alter hook on plugin discovery, so other modules can act on this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

uniquename created an issue. See original summary.

uniquename’s picture

Find a patch attached that works for me.

uniquename’s picture

Title: Implement alter hooks for workflow and workflow group plgins » Implement alter hooks for workflow and workflow group plugins
joachim’s picture

Status: Active » Needs work

I'm not sure about this.

AFAICT, core doesn't provide alter hooks for YML-based plugins -- at least, I can't spot them for menu tasks and actions.

  1. +++ b/state_machine.api.php
    @@ -0,0 +1,35 @@
    + * @param $info
    + *   Devel dumper information to alter.
    

    Docs don't match the param.

  2. +++ b/state_machine.api.php
    @@ -0,0 +1,35 @@
    + * @param $info
    + *   Devel dumper information to alter.
    

    Same.

uniquename’s picture

There is one in core/lib/Drupal/Core/Menu/LocalTaskManager.php Line 140.

I needed a way, to act on new workflows beeing installed and this was a propper way for me to achieve this.

Ups, fixed the docs...

bojanz’s picture

Assigned: Unassigned » bojanz

Let's proceed with adding these alter hooks.

Looked at core YAML plugins, alter hooks are provided for breakpoints, local actions, local tasks, contextual links, config translation mappers.
They are not provided only for layouts.

I would personally prefer if people didn't alter workflows, but the Drupal philosophy was never about preventing you from shooting yourself in the foot.

Let's remove "plugins" from the alter hook names though, core only has that naming for contextual links.
So we'd have hook_workflows_alter() and hook_workflow_groups_alter().

  • bojanz committed a1f57c6 on 8.x-1.x authored by uniquename
    Issue #2982653 by uniquename, bojanz: Implement alter hooks for workflow...
bojanz’s picture

Status: Needs work » Fixed

Tweaked and committed. Thanks!

Status: Fixed » Closed (fixed)

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