class WorkflowState in State Machine 8
Defines the class for workflow states.
Hierarchy
- class \Drupal\state_machine\Plugin\Workflow\WorkflowState
Expanded class hierarchy of WorkflowState
1 file declares its use of WorkflowState
- StateItem.php in src/
Plugin/ Field/ FieldType/ StateItem.php
File
- src/
Plugin/ Workflow/ WorkflowState.php, line 8
Namespace
Drupal\state_machine\Plugin\WorkflowView source
class WorkflowState {
/**
* The state ID.
*
* @var string
*/
protected $id;
/**
* The state label.
*
* @var string
*/
protected $label;
/**
* Constructs a new WorkflowState object.
*
* @param string $id
* The state ID.
* @param string $label
* The state label.
*/
public function __construct($id, $label) {
$this->id = $id;
$this->label = $label;
}
/**
* Gets the ID.
*
* @return string
* The ID.
*/
public function getId() {
return $this->id;
}
/**
* Gets the translated label.
*
* @return string
* The translated label.
*/
public function getLabel() {
return (string) t($this->label, [], [
'context' => 'workflow state',
]);
}
/**
* Gets the string representation of the workflow state.
*
* @return string
* The string representation of the workflow state.
*/
public function __toString() {
return $this
->getLabel();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WorkflowState:: |
protected | property | The state ID. | |
WorkflowState:: |
protected | property | The state label. | |
WorkflowState:: |
public | function | Gets the ID. | |
WorkflowState:: |
public | function | Gets the translated label. | |
WorkflowState:: |
public | function | Constructs a new WorkflowState object. | |
WorkflowState:: |
public | function | Gets the string representation of the workflow state. |