You are here

public function JobState::getValueOptions in Translation Management Tool 8

Gets the values of the options.

Return value

array Returns options.

Overrides InOperator::getValueOptions

File

src/Plugin/views/filter/JobState.php, line 33

Class

JobState
Filter based on job state.

Namespace

Drupal\tmgmt\Plugin\views\filter

Code

public function getValueOptions() {
  $this->valueOptions = [
    'open_jobs' => t('- Open jobs -'),
    '0' => t('Unprocessed'),
  ];
  $state_definitions = JobItem::getStateDefinitions();
  foreach ($state_definitions as $state => $state_definition) {
    if (!empty($state_definition['show_job_filter'])) {
      $this->valueOptions['job_item_' . $state] = $this
        ->t('Items - @item_state', [
        '@item_state' => $state_definition['label'],
      ]);
    }
  }
  $this->valueOptions += [
    '2' => t('Rejected'),
    '4' => t('Aborted'),
    '5' => t('Finished'),
  ];
  if (\Drupal::service('tmgmt.continuous')
    ->checkIfContinuousTranslatorAvailable()) {
    $this->valueOptions['6'] = t('Continuous');
  }
  return $this->valueOptions;
}