You are here

protected function LingotekConfigManagementForm::getSourceStatus in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 8 src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  2. 8.2 src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  3. 4.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  4. 3.0.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  5. 3.1.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  6. 3.2.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  7. 3.3.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  8. 3.4.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  9. 3.5.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  10. 3.7.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()
  11. 3.8.x src/Form/LingotekConfigManagementForm.php \Drupal\lingotek\Form\LingotekConfigManagementForm::getSourceStatus()

Gets the source status of an config in a format ready to display.

Parameters

\Drupal\config_translation\ConfigMapperInterface $mapper: The mapper.

Return value

array A render array.

1 call to LingotekConfigManagementForm::getSourceStatus()
LingotekConfigManagementForm::buildForm in src/Form/LingotekConfigManagementForm.php
Form constructor.

File

src/Form/LingotekConfigManagementForm.php, line 1369

Class

LingotekConfigManagementForm
Form for bulk management of content.

Namespace

Drupal\lingotek\Form

Code

protected function getSourceStatus(ConfigMapperInterface $mapper) {
  $is_config_entity = $mapper instanceof ConfigEntityMapper;
  $entity = $is_config_entity ? $mapper
    ->getEntity() : NULL;
  $language_source = $this->languageLocaleMapper
    ->getConfigurableLanguageForLocale($is_config_entity ? $this->translationService
    ->getSourceLocale($entity) : $this->translationService
    ->getConfigSourceLocale($mapper));
  $source_status = $is_config_entity ? $this->translationService
    ->getSourceStatus($entity) : $this->translationService
    ->getConfigSourceStatus($mapper);
  $data = [
    'data' => [
      '#type' => 'inline_template',
      '#template' => '<span class="language-icon source-{{status}}" title="{{status_title}}">{% if url %}<a href="{{url}}">{%endif%}{{language}}{%if url %}</a>{%endif%}</span>',
      '#context' => [
        'language' => empty($language_source) ? 'N/A' : strtoupper($language_source
          ->id()),
        'status' => strtolower($source_status),
        'status_title' => $this
          ->getSourceStatusText($mapper, $source_status),
        'url' => $this
          ->getSourceActionUrl($mapper, $source_status),
      ],
    ],
  ];
  return $data;
}