summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Rowlands2017-09-03 07:05:16 (GMT)
committerLee Rowlands2017-09-03 07:05:16 (GMT)
commitfe7caba729f7b038893b3730fc832614f7f65a17 (patch)
treec7ff13d9d47ab658b38df95e81235770d8490569
parent48a8e5307f6236622f46cb54bef6c24e17757d92 (diff)
Issue #2899553 by timmillwood, Sam152, Wim Leers: Architectural review of the Workflows module
-rw-r--r--core/modules/workflows/config/schema/workflows.schema.yml1
-rw-r--r--core/modules/workflows/src/Annotation/WorkflowType.php11
-rw-r--r--core/modules/workflows/src/Entity/Workflow.php9
-rw-r--r--core/modules/workflows/src/State.php2
-rw-r--r--core/modules/workflows/src/StateInterface.php4
-rw-r--r--core/modules/workflows/src/TransitionInterface.php5
-rw-r--r--core/modules/workflows/src/WorkflowTypeInterface.php30
-rw-r--r--core/modules/workflows/workflows.info.yml2
-rw-r--r--core/modules/workflows/workflows.links.menu.yml1
-rw-r--r--core/modules/workflows/workflows.module3
10 files changed, 30 insertions, 38 deletions
diff --git a/core/modules/workflows/config/schema/workflows.schema.yml b/core/modules/workflows/config/schema/workflows.schema.yml
index 1232801..42a5d97 100644
--- a/core/modules/workflows/config/schema/workflows.schema.yml
+++ b/core/modules/workflows/config/schema/workflows.schema.yml
@@ -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
diff --git a/core/modules/workflows/src/Annotation/WorkflowType.php b/core/modules/workflows/src/Annotation/WorkflowType.php
index 755ac70..8ba6aec 100644
--- a/core/modules/workflows/src/Annotation/WorkflowType.php
+++ b/core/modules/workflows/src/Annotation/WorkflowType.php
@@ -12,7 +12,8 @@ use Drupal\Component\Annotation\Plugin;
* 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
diff --git a/core/modules/workflows/src/Entity/Workflow.php b/core/modules/workflows/src/Entity/Workflow.php
index 7876287..b903161 100644
--- a/core/modules/workflows/src/Entity/Workflow.php
+++ b/core/modules/workflows/src/Entity/Workflow.php
@@ -32,7 +32,7 @@ use Drupal\workflows\WorkflowInterface;
* },
* "route_provider" = {
* "html" = "Drupal\Core\Entity\Routing\AdminHtmlRouteProvider",
- * }
+ * },
* },
* config_prefix = "workflow",
* admin_permission = "administer workflows",
@@ -47,13 +47,13 @@ use Drupal\workflows\WorkflowInterface;
* "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 = [];
diff --git a/core/modules/workflows/src/State.php b/core/modules/workflows/src/State.php
index f6a377b..c40c2a7 100644
--- a/core/modules/workflows/src/State.php
+++ b/core/modules/workflows/src/State.php
@@ -104,7 +104,7 @@ class State implements StateInterface {
}
/**
- * 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
*
diff --git a/core/modules/workflows/src/StateInterface.php b/core/modules/workflows/src/StateInterface.php
index 5a5442b..6cc8ace 100644
--- a/core/modules/workflows/src/StateInterface.php
+++ b/core/modules/workflows/src/StateInterface.php
@@ -6,8 +6,8 @@ namespace Drupal\workflows;
* 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 {
diff --git a/core/modules/workflows/src/TransitionInterface.php b/core/modules/workflows/src/TransitionInterface.php
index 14f6d14..0fa159c 100644
--- a/core/modules/workflows/src/TransitionInterface.php
+++ b/core/modules/workflows/src/TransitionInterface.php
@@ -6,8 +6,9 @@ namespace Drupal\workflows;
* 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 {
diff --git a/core/modules/workflows/src/WorkflowTypeInterface.php b/core/modules/workflows/src/WorkflowTypeInterface.php
index 0d91071..4ffa4d0 100644
--- a/core/modules/workflows/src/WorkflowTypeInterface.php
+++ b/core/modules/workflows/src/WorkflowTypeInterface.php
@@ -71,9 +71,9 @@ interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInsp
/**
* 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 @@ interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInsp
* @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 @@ interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInsp
* @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 @@ interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInsp
* @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 @@ interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInsp
* @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 @@ interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInsp
* @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 @@ interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInsp
* @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 @@ interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInsp
* @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 @@ interface WorkflowTypeInterface extends PluginWithFormsInterface, DerivativeInsp
* @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.
diff --git a/core/modules/workflows/workflows.info.yml b/core/modules/workflows/workflows.info.yml
index 0089a12..4f307d1 100644
--- a/core/modules/workflows/workflows.info.yml
+++ b/core/modules/workflows/workflows.info.yml
@@ -1,6 +1,6 @@
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)
diff --git a/core/modules/workflows/workflows.links.menu.yml b/core/modules/workflows/workflows.links.menu.yml
index a6ac512..ca191d5 100644
--- a/core/modules/workflows/workflows.links.menu.yml
+++ b/core/modules/workflows/workflows.links.menu.yml
@@ -1,4 +1,3 @@
-# Workflow menu items definition
entity.workflow.collection:
title: 'Workflows'
route_name: entity.workflow.collection
diff --git a/core/modules/workflows/workflows.module b/core/modules/workflows/workflows.module
index 096fd92..f72d7bd 100644
--- a/core/modules/workflows/workflows.module
+++ b/core/modules/workflows/workflows.module
@@ -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 @@ use Drupal\Core\Routing\RouteMatchInterface;
*/
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>';