Unverified Commit fe7caba7 authored by larowlan's avatar larowlan

Issue #2899553 by timmillwood, Sam152, Wim Leers: Architectural review of the Workflows module

parent 48a8e530
......@@ -13,7 +13,6 @@ workflows.workflow.*:
label: 'Workflow type'
type_settings:
type: workflow.type_settings.[%parent.type]
label: 'Custom settings for workflow type'
workflows.state:
type: mapping
......
......@@ -12,7 +12,8 @@
* For a working example, see \Drupal\content_moderation\Plugin\Workflow\ContentModerate
*
* @see \Drupal\workflows\WorkflowTypeInterface
* @see \Drupal\workflows\WorkflowManager
* @see \Drupal\workflows\WorkflowTypeManager
* @see workflow_type_info_alter()
* @see plugin_api
*
* @Annotation
......@@ -33,8 +34,6 @@ class WorkflowType extends Plugin {
/**
* The label of the workflow.
*
* Describes how the plugin is used to apply a workflow to something.
*
* @var \Drupal\Core\Annotation\Translation
*
* @ingroup plugin_translatable
......@@ -53,8 +52,10 @@ class WorkflowType extends Plugin {
/**
* A list of optional form classes implementing PluginFormInterface.
*
* Forms which will be used for the workflow UI are 'configure', 'state' and
* 'transition'.
* Forms which will be used for the workflow UI are:
* - 'configure' (\Drupal\workflows\WorkflowTypeInterface::PLUGIN_FORM_KEY)
* - 'state' (\Drupal\workflows\StateInterface::PLUGIN_FORM_KEY)
* - 'transition' (\Drupal\workflows\TransitionInterface::PLUGIN_FORM_KEY)
*
* @see \Drupal\Core\Plugin\PluginWithFormsInterface
* @see \Drupal\Core\Plugin\PluginFormInterface
......
......@@ -32,7 +32,7 @@
* },
* "route_provider" = {
* "html" = "Drupal\Core\Entity\Routing\AdminHtmlRouteProvider",
* }
* },
* },
* config_prefix = "workflow",
* admin_permission = "administer workflows",
......@@ -47,13 +47,13 @@
* "delete-form" = "/admin/config/workflow/workflows/manage/{workflow}/delete",
* "add-state-form" = "/admin/config/workflow/workflows/manage/{workflow}/add_state",
* "add-transition-form" = "/admin/config/workflow/workflows/manage/{workflow}/add_transition",
* "collection" = "/admin/config/workflow/workflows"
* "collection" = "/admin/config/workflow/workflows",
* },
* config_export = {
* "id",
* "label",
* "type",
* "type_settings"
* "type_settings",
* },
* )
*
......@@ -71,7 +71,7 @@ class Workflow extends ConfigEntityBase implements WorkflowInterface, EntityWith
protected $id;
/**
* The Moderation state label.
* The workflow label.
*
* @var string
*/
......@@ -88,6 +88,7 @@ class Workflow extends ConfigEntityBase implements WorkflowInterface, EntityWith
/**
* The configuration for the workflow type plugin.
*
* @var array
*/
protected $type_settings = [];
......
......@@ -104,7 +104,7 @@ public function getTransitions() {
}
/**
* Helper method to convert a list of states to labels
* Helper method to convert a State value object to a label.
*
* @param \Drupal\workflows\StateInterface $state
*
......
......@@ -6,8 +6,8 @@
* An interface for state value objects.
*
* @internal
* The workflow system is currently experimental and should only be leveraged
* by experimental modules and development releases of contributed modules.
* The StateInterface should only be used by Workflows and Content Moderation.
* @todo Revisit the need for this in https://www.drupal.org/node/2902309.
*/
interface StateInterface {
......
......@@ -6,8 +6,9 @@
* A transition value object that describes the transition between two states.
*
* @internal
* The workflow system is currently experimental and should only be leveraged
* by experimental modules and development releases of contributed modules.
* The TransitionInterface should only be used by Workflows and Content
* Moderation.
* @todo Revisit the need for this in https://www.drupal.org/node/2902309.
*/
interface TransitionInterface {
......
......@@ -71,9 +71,9 @@ public function getInitialState();
/**
* Gets the required states of workflow type.
*
* This are usually configured in the workflow type annotation.
* This is usually specified in the workflow type annotation.
*
* @return array[]
* @return string[]
* The required states.
*
* @see \Drupal\workflows\Annotation\WorkflowType
......@@ -103,8 +103,7 @@ public function onDependencyRemoval(array $dependencies);
* @param string $label
* The state's label.
*
* @return \Drupal\workflows\WorkflowTypeInterface
* The workflow type plugin.
* @return $this
*
* @throws \InvalidArgumentException
* Thrown if a state already exists or state ID is invalid.
......@@ -158,8 +157,7 @@ public function getState($state_id);
* @param string $label
* The state's label.
*
* @return \Drupal\workflows\WorkflowTypeInterface
* The workflow type plugin.
* @return $this
*/
public function setStateLabel($state_id, $label);
......@@ -171,8 +169,7 @@ public function setStateLabel($state_id, $label);
* @param int $weight
* The state's weight.
*
* @return \Drupal\workflows\WorkflowTypeInterface
* The workflow type plugin.
* @return $this
*/
public function setStateWeight($state_id, $weight);
......@@ -202,8 +199,7 @@ public function deleteState($state_id);
* @param string $to_state_id
* The state ID to transition to.
*
* @return \Drupal\workflows\WorkflowTypeInterface
* The workflow type plugin.
* @return $this
*
* @throws \InvalidArgumentException
* Thrown if either state does not exist.
......@@ -301,8 +297,7 @@ public function hasTransitionFromStateToState($from_state_id, $to_state_id);
* @param string $label
* The transition's label.
*
* @return \Drupal\workflows\WorkflowTypeInterface
* The workflow type plugin.
* @return $this
*
* @throws \InvalidArgumentException
* Thrown if the transition does not exist.
......@@ -317,8 +312,7 @@ public function setTransitionLabel($transition_id, $label);
* @param int $weight
* The transition's weight.
*
* @return \Drupal\workflows\WorkflowTypeInterface
* The workflow type plugin.
* @return $this
*
* @throws \InvalidArgumentException
* Thrown if the transition does not exist.
......@@ -333,13 +327,12 @@ public function setTransitionWeight($transition_id, $weight);
* @param array $from_state_ids
* The state IDs to transition from.
*
* @return \Drupal\workflows\WorkflowTypeInterface
* The workflow type plugin.
* @return $this
*
* @throws \InvalidArgumentException
* Thrown if the transition does not exist or the states do not exist.
*/
public function setTransitionFromStates($transition_id, array $from_state_ids);
public function setTransitionFromStates($transition_id, array $from_state_ids);
/**
* Deletes a transition.
......@@ -347,8 +340,7 @@ public function setTransitionFromStates($transition_id, array $from_state_ids)
* @param string $transition_id
* The transition ID.
*
* @return \Drupal\workflows\WorkflowTypeInterface
* The workflow type plugin.
* @return $this
*
* @throws \InvalidArgumentException
* Thrown if the transition does not exist.
......
name: 'Workflows'
type: module
description: 'Provides UI and API for managing workflows. This module can be used with the Content moderation module to add highly customisable workflows to content.'
description: 'Provides UI and API for managing workflows. This module can be used with the Content moderation module to add highly customizable workflows to content.'
version: VERSION
core: 8.x
package: Core (Experimental)
......
# Workflow menu items definition
entity.workflow.collection:
title: 'Workflows'
route_name: entity.workflow.collection
......
......@@ -2,7 +2,7 @@
/**
* @file
* Provides hook implementations for the Workflow UI module.
* Provides hook implementations for the Workflows module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
......@@ -12,7 +12,6 @@
*/
function workflows_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the Workflow UI module.
case 'help.page.workflows':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment