You are here

public function LingotekSourceStatus::preRender in Lingotek Translation 3.5.x

Same name and namespace in other branches
  1. 8.2 src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::preRender()
  2. 4.0.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::preRender()
  3. 3.0.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::preRender()
  4. 3.1.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::preRender()
  5. 3.2.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::preRender()
  6. 3.3.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::preRender()
  7. 3.4.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::preRender()
  8. 3.6.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::preRender()
  9. 3.7.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::preRender()
  10. 3.8.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::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/LingotekSourceStatus.php, line 46

Class

LingotekSourceStatus
Provides a Lingotek source status element.

Namespace

Drupal\lingotek\Element

Code

public function preRender(array $element) {
  if (isset($element['#entity'])) {
    $element['#url'] = $this
      ->getSourceActionUrl($element['#entity'], $element['#status']);
    $element['#status_title'] = $this
      ->getSourceStatusText($element['#entity'], $element['#status']);
  }
  elseif (isset($element['#ui_component'])) {
    $element['#url'] = $this
      ->getSourceActionUrlForUI($element['#ui_component'], $element['#status']);
    $element['#status_title'] = $this
      ->getSourceStatusTextForUI($element['#ui_component'], $element['#status']);
  }
  return $element;
}