You are here

public function LingotekApi::listWorkflows in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listWorkflows()
  2. 7.3 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listWorkflows()
  3. 7.4 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listWorkflows()
  4. 7.5 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listWorkflows()
  5. 7.6 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::listWorkflows()

Gets available Lingotek Workflows.

Parameters

$reset: A boolean value to determine whether we need to query the API

$include_public: A boolean value to determine whether to show public workflows

Return value

array An array of available Workflows with workflow IDs as keys, workflow labels as values.

File

lib/Drupal/lingotek/LingotekApi.php, line 893
Defines Drupal\lingotek\LingotekApi

Class

LingotekApi
@file Defines Drupal\lingotek\LingotekApi

Code

public function listWorkflows($reset = FALSE, $include_public = FALSE) {
  $workflows = variable_get('lingotek_workflow_defaults', array());
  if (!empty($workflows) && $reset == FALSE) {
    return $workflows;
  }
  if ($workflows_raw = $this
    ->request('listWorkflows')) {
    $workflows = array();
    foreach ($workflows_raw->workflows as $workflow) {
      if ($include_public || !$workflow->is_public && $workflow->owner != LINGOTEK_DEFAULT_WORKFLOW_TEMPLATE) {
        $workflows[$workflow->id] = $workflow->name;
      }
    }
    variable_set('lingotek_workflow_defaults', $workflows);
  }
  return $workflows;
}