WorkflowTypeBase
abstract class WorkflowTypeBase extends PluginBase implements WorkflowTypeInterface (View source)
A base class for Workflow type plugins.
Traits
Provides a trait with typical behavior for plugins which have forms.
Constants
| DERIVATIVE_SEPARATOR |
A string which is used to separate base plugin IDs from the derivative ID. |
| VALID_ID_REGEX |
A regex for matching a valid state/transition machine name. |
Properties
| protected string | $pluginId | The plugin_id. |
from PluginBase |
| protected array | $pluginDefinition | The plugin implementation definition. |
from PluginBase |
| protected array | $configuration | Configuration information passed into the plugin. |
from PluginBase |
Methods
Constructs a \Drupal\Component\Plugin\PluginBase object.
Implements \Drupal\Core\Plugin\PluginWithFormsInterface::getFormClass().
Implements \Drupal\Core\Plugin\PluginWithFormsInterface::hasFormClass().
Gets the label for the workflow type.
Determines if the workflow is being has data associated with it.
Determines if the workflow state has data associated with it.
Gets this plugin's configuration.
Sets the configuration for this plugin instance.
Gets the required states of workflow type.
Gets default configuration for this plugin.
Calculates dependencies for the configured plugin.
Informs the plugin that a dependency of the workflow will be deleted.
Gets the initial state for the workflow.
Adds a state to the workflow.
Determines if the workflow has a state with the provided ID.
Gets state objects for the provided state IDs.
Gets a workflow state.
Sets a state's label.
Sets a state's weight value.
Deletes a state from the workflow.
Adds a transition to the workflow.
Gets transition objects for the provided transition IDs.
Sort states or transitions by weight, label, and key.
Gets a transition object for the provided transition ID.
Determines if a transition exists.
Gets the transition IDs for a state for the provided direction.
Gets a transition from state to state.
Determines if a transition from state to state exists.
Gets the transition ID from state to state.
Sets a transition's label.
Sets a transition's weight.
Sets a transition's from states.
Deletes a transition.
Gets the weight for a new state or transition.
Details
__construct(array $configuration, string $plugin_id, mixed $plugin_definition)
Constructs a \Drupal\Component\Plugin\PluginBase object.
string
getPluginId()
Gets the plugin_id of the plugin instance.
string
getBaseId()
Gets the base_plugin_id of the plugin instance.
string|null
getDerivativeId()
Gets the derivative_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
bool
isConfigurable()
Determines if the plugin is configurable.
getFormClass($operation)
Implements \Drupal\Core\Plugin\PluginWithFormsInterface::getFormClass().
hasFormClass($operation)
Implements \Drupal\Core\Plugin\PluginWithFormsInterface::hasFormClass().
string
label()
Gets the label for the workflow type.
bool
workflowHasData(WorkflowInterface $workflow)
Determines if the workflow is being has data associated with it.
bool
workflowStateHasData(WorkflowInterface $workflow, StateInterface $state)
Determines if the workflow state has data associated with it.
array
getConfiguration()
Gets this plugin's configuration.
setConfiguration(array $configuration)
Sets the configuration for this plugin instance.
string[]
getRequiredStates()
Gets the required states of workflow type.
This is usually specified in the workflow type annotation.
array
defaultConfiguration()
Gets default configuration for this plugin.
array
calculateDependencies()
Calculates dependencies for the configured plugin.
Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.
bool
onDependencyRemoval(array $dependencies)
Informs the plugin that a dependency of the workflow will be deleted.
StateInterface
getInitialState()
Gets the initial state for the workflow.
$this
addState(string $state_id, string $label)
Adds a state to the workflow.
bool
hasState(string $state_id)
Determines if the workflow has a state with the provided ID.
StateInterface[]
getStates(string[] $state_ids = NULL)
Gets state objects for the provided state IDs.
StateInterface
getState(string $state_id)
Gets a workflow state.
$this
setStateLabel(string $state_id, string $label)
Sets a state's label.
$this
setStateWeight(string $state_id, int $weight)
Sets a state's weight value.
$this
deleteState(string $state_id)
Deletes a state from the workflow.
$this
addTransition($transition_id, string $label, array $from_state_ids, string $to_state_id)
Adds a transition to the workflow.
TransitionInterface[]
getTransitions(array $transition_ids = NULL)
Gets transition objects for the provided transition IDs.
static protected StateInterface[]|TransitionInterface[]
labelWeightMultisort(StateInterface[]|TransitionInterface[] $objects)
Sort states or transitions by weight, label, and key.
TransitionInterface
getTransition(string $transition_id)
Gets a transition object for the provided transition ID.
bool
hasTransition(string $transition_id)
Determines if a transition exists.
array
getTransitionsForState($state_id, string $direction = TransitionInterface::DIRECTION_FROM)
Gets the transition IDs for a state for the provided direction.
TransitionInterface
getTransitionFromStateToState(string $from_state_id, string $to_state_id)
Gets a transition from state to state.
bool
hasTransitionFromStateToState(string $from_state_id, string $to_state_id)
Determines if a transition from state to state exists.
protected string|null
getTransitionIdFromStateToState(string $from_state_id, string $to_state_id)
Gets the transition ID from state to state.
$this
setTransitionLabel(string $transition_id, string $label)
Sets a transition's label.
$this
setTransitionWeight(string $transition_id, int $weight)
Sets a transition's weight.
$this
setTransitionFromStates(string $transition_id, array $from_state_ids)
Sets a transition's from states.
$this
deleteTransition(string $transition_id)
Deletes a transition.
protected int
getNextWeight(array $items)
Gets the weight for a new state or transition.