You are here

protected function JobItemForm::buildStatusRenderArray in Translation Management Tool 8

Builds the render array for the status icon.

Parameters

int $status: Data item status.

Return value

array The render array for the status icon.

1 call to JobItemForm::buildStatusRenderArray()
JobItemForm::reviewFormElement in src/Form/JobItemForm.php
Build form elements for the review form using flattened data items.

File

src/Form/JobItemForm.php, line 525

Class

JobItemForm
Form controller for the job item edit forms.

Namespace

Drupal\tmgmt\Form

Code

protected function buildStatusRenderArray($status) {
  $classes = array();
  $classes[] = 'tmgmt-ui-icon';

  // Icon size 32px square.
  $classes[] = 'tmgmt-ui-icon-32';
  switch ($status) {
    case TMGMT_DATA_ITEM_STATE_ACCEPTED:
      $title = t('Accepted');
      $icon = 'core/misc/icons/73b355/check.svg';
      break;
    case TMGMT_DATA_ITEM_STATE_REVIEWED:
      $title = t('Reviewed');
      $icon = drupal_get_path('module', 'tmgmt') . '/icons/gray-check.svg';
      break;
    case TMGMT_DATA_ITEM_STATE_TRANSLATED:
      $title = t('Translated');
      $icon = drupal_get_path('module', 'tmgmt') . '/icons/ready.svg';
      break;
    case TMGMT_DATA_ITEM_STATE_PENDING:
    default:
      $title = t('Pending');
      $icon = drupal_get_path('module', 'tmgmt') . '/icons/hourglass.svg';
      break;
  }
  return [
    '#type' => 'container',
    '#attributes' => [
      'class' => $classes,
    ],
    'icon' => [
      '#theme' => 'image',
      '#uri' => $icon,
      '#title' => $title,
      '#alt' => $title,
    ],
  ];
}