function template_preprocess_tmgmt_local_translation_form_element_status

Implements template_preprocess_HOOK().

File

translators/tmgmt_local/tmgmt_local.theme.inc, line 53
Theme file stub for tmgmt.

Code

function template_preprocess_tmgmt_local_translation_form_element_status(array &$variables) {
  $classes = [
    'tmgmt-ui-icon',
    'tmgmt-ui-icon-32',
  ];
  switch ($variables['status']['#value']) {
    case TMGMT_DATA_ITEM_STATE_COMPLETED:
      $title = t('Accepted');
      $icon = 'core/misc/icons/73b355/check.svg';
      break;
    case TMGMT_DATA_ITEM_STATE_TRANSLATED:
      $title = t('Translated');
      $icon = \Drupal::service('extension.list.module')
        ->getPath('tmgmt') . '/icons/gray-check.svg';
      break;
    case TMGMT_DATA_ITEM_STATE_UNTRANSLATED:
    default:
      $title = t('Untranslated');
      $icon = \Drupal::service('extension.list.module')
        ->getPath('tmgmt') . '/icons/ready.svg';
      break;
  }
  $variables['wrapper_attributes'] = new Attribute([
    'class' => $classes,
  ]);
  $variables['icon_url'] = \Drupal::service('file_url_generator')
    ->generateString($icon);
  $variables['title'] = $title;
}