You are here

protected function StatesListFormatter::getStatesFromWorkflow in Workflows Field 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldFormatter/StatesListFormatter.php \Drupal\workflows_field\Plugin\Field\FieldFormatter\StatesListFormatter::getStatesFromWorkflow()

Gets all available states from the workflow for this field.

Return value

\Drupal\workflows\StateInterface[] An array of workflow states.

2 calls to StatesListFormatter::getStatesFromWorkflow()
StatesListFormatter::buildItems in src/Plugin/Field/FieldFormatter/StatesListFormatter.php
Builds the items array for theme item list.
StatesListFormatter::settingsForm in src/Plugin/Field/FieldFormatter/StatesListFormatter.php
Returns a form to configure settings for the formatter.

File

src/Plugin/Field/FieldFormatter/StatesListFormatter.php, line 97

Class

StatesListFormatter
Plugin implementation of the 'workflows_field_state_list' formatter.

Namespace

Drupal\workflows_field\Plugin\Field\FieldFormatter

Code

protected function getStatesFromWorkflow() {
  $workflow = Workflow::load($this
    ->getFieldSetting('workflow'));
  $type = $workflow
    ->getTypePlugin();
  return $type
    ->getStates();
}