Error message

  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1075 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1079 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1075 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1079 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1075 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1079 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1075 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1079 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1075 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1079 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1075 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Notice: Undefined property: stdClass::$preferred in _api_make_match_link() (line 1079 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).

protected function JobItemForm::buildStatusRenderArray

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 541

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::service('extension.list.module')
        ->getPath('tmgmt') . '/icons/gray-check.svg';
      break;
    case TMGMT_DATA_ITEM_STATE_TRANSLATED:
      $title = t('Translated');
      $icon = \Drupal::service('extension.list.module')
        ->getPath('tmgmt') . '/icons/ready.svg';
      break;
    case TMGMT_DATA_ITEM_STATE_PENDING:
    default:
      $title = t('Pending');
      $icon = \Drupal::service('extension.list.module')
        ->getPath('tmgmt') . '/icons/hourglass.svg';
      break;
  }
  return [
    '#type' => 'container',
    '#attributes' => [
      'class' => $classes,
    ],
    'icon' => [
      '#theme' => 'image',
      '#uri' => $icon,
      '#title' => $title,
      '#alt' => $title,
    ],
  ];
}