Builds the render array for the status icon.
int $status: Data item status.
array The render array for the status icon.
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,
],
];
}