You are here

protected function StateItem::getStateLabel in State Machine 8

Gets the state label for the given state ID.

Parameters

string $state_id: The state ID.

Return value

string The state label.

2 calls to StateItem::getStateLabel()
StateItem::getLabel in src/Plugin/Field/FieldType/StateItem.php
Gets the label of the current state.
StateItem::getOriginalLabel in src/Plugin/Field/FieldType/StateItem.php
Gets the label of the original state.

File

src/Plugin/Field/FieldType/StateItem.php, line 293

Class

StateItem
Plugin implementation of the 'state' field type.

Namespace

Drupal\state_machine\Plugin\Field\FieldType

Code

protected function getStateLabel($state_id) {
  $label = $state_id;
  if ($workflow = $this
    ->getWorkflow()) {
    $state = $workflow
      ->getState($state_id);
    if ($state) {
      $label = $state
        ->getLabel();
    }
  }
  return $label;
}