You are here

function lingotek_get_phases_by_workflow_id in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.module \lingotek_get_phases_by_workflow_id()
  2. 7.5 lingotek.module \lingotek_get_phases_by_workflow_id()
  3. 7.6 lingotek.module \lingotek_get_phases_by_workflow_id()
3 calls to lingotek_get_phases_by_workflow_id()
lingotek_admin_profile_form in ./lingotek.admin.inc
Content defaults Form
lingotek_form_node_form_alter in ./lingotek.module
Implements hook_form_BASE_FORM_ID_alter().
lingotek_get_change_workflow_form in ./lingotek.module

File

./lingotek.module, line 2235

Code

function lingotek_get_phases_by_workflow_id($workflow_id) {
  $api = LingotekApi::instance();
  $response = $api
    ->request('getWorkflow', array(
    'id' => $workflow_id,
  ));
  $phases = array();
  $excluded_phases = array(
    'Project Setup',
    'Workflow Completion',
  );
  if (isset($response->workflow->steps)) {
    foreach ($response->workflow->steps as $id => $phase_obj) {
      if (!in_array($phase_obj->name, $excluded_phases)) {
        $phases[$id] = $phase_obj->name;
      }
    }
  }
  return $phases;
}