You are here

public function LingotekTargetStatuses::preRender in Lingotek Translation 3.7.x

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

Calculates the url and status title and adds them to the render array.

Parameters

array $element: The element as a render array.

Return value

array The element as a render array.

File

src/Element/LingotekTargetStatuses.php, line 54

Class

LingotekTargetStatuses
Provides a Lingotek target status element.

Namespace

Drupal\lingotek\Element

Code

public function preRender(array $element) {
  $statuses = NULL;
  if (isset($element['#entity'])) {
    $statuses = $this
      ->getTranslationsStatuses($element['#entity'], $element['#source_langcode'], $element['#statuses']);
  }
  if (isset($element['#mapper'])) {
    $statuses = $this
      ->getTranslationsStatusesForConfigMapper($element['#mapper'], $element['#source_langcode'], $element['#statuses']);
  }
  elseif (isset($element['#ui_component'])) {
    $statuses = $this
      ->getTranslationsStatusesForUI($element['#ui_component'], $element['#source_langcode'], $element['#statuses']);
  }
  $element['#statuses'] = $statuses;
  return $element;
}