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).

function SourcePluginUiBase::buildTranslationStatus

Builds the translation status render array with source and job item status.

Parameters

int $status: The source status: original, missing, current or outofdate.

\Drupal\tmgmt\JobItemInterface|NULL $job_item: The existing job item for the source.

Return value

array The render array for displaying the status.

4 calls to SourcePluginUiBase::buildTranslationStatus()
ConfigSourcePluginUi::overviewRow in sources/tmgmt_config/src/ConfigSourcePluginUi.php
Builds a table row for overview form.
ConfigSourcePluginUi::overviewRowSimple in sources/tmgmt_config/src/ConfigSourcePluginUi.php
Builds a table row for simple configuration.
ContentEntitySourcePluginUi::overviewRow in sources/content/src/ContentEntitySourcePluginUi.php
Builds a table row for overview form.
LocaleSourcePluginUi::overviewRow in sources/locale/src/LocaleSourcePluginUi.php
Builds a table row for overview form.

File

src/SourcePluginUiBase.php, line 293

Class

SourcePluginUiBase
Default ui controller class for source plugin.

Namespace

Drupal\tmgmt

Code

function buildTranslationStatus($status, JobItemInterface $job_item = NULL) {
  switch ($status) {
    case 'original':
      $label = t('Original language');
      $icon = 'core/misc/icons/bebebe/house.svg';
      break;
    case 'missing':
      $label = t('Not translated');
      $icon = 'core/misc/icons/bebebe/ex.svg';
      break;
    case 'outofdate':
      $label = t('Translation Outdated');
      $icon = \Drupal::service('extension.list.module')
        ->getPath('tmgmt') . '/icons/outdated.svg';
      break;
    default:
      $label = t('Translation up to date');
      $icon = 'core/misc/icons/73b355/check.svg';
  }
  $build['source'] = [
    '#theme' => 'image',
    '#uri' => $icon,
    '#title' => $label,
    '#alt' => $label,
  ];

  // If we have an active job item, wrap it in a link.
  if ($job_item) {
    $url = $job_item
      ->toUrl();
    if ($job_item
      ->isActive() && $job_item
      ->getJob() && $job_item
      ->getJob()
      ->isUnprocessed()) {
      $url = $job_item
        ->getJob()
        ->toUrl();
    }
    $url
      ->setOption('query', \Drupal::destination()
      ->getAsArray());
    $item_icon = $job_item
      ->getStateIcon();
    if ($item_icon) {
      $item_icon['#title'] = $this
        ->t('Active job item: @state', [
        '@state' => $item_icon['#title'],
      ]);
      $build['job_item'] = [
        '#type' => 'link',
        '#url' => $url,
        '#title' => $item_icon,
      ];
    }
  }
  return $build;
}