protected function LingotekSourceStatus::getSourceActionUrl in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 8.2 src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
- 4.0.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
- 3.0.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
- 3.1.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
- 3.2.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
- 3.3.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
- 3.4.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
- 3.5.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
- 3.7.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
- 3.8.x src/Element/LingotekSourceStatus.php \Drupal\lingotek\Element\LingotekSourceStatus::getSourceActionUrl()
Get the source action url based on the source status.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.
string $source_status: The source status.
Return value
\Drupal\Core\Url An url object.
1 call to LingotekSourceStatus::getSourceActionUrl()
- LingotekSourceStatus::preRender in src/
Element/ LingotekSourceStatus.php - Calculates the url and status title and adds them to the render array.
File
- src/
Element/ LingotekSourceStatus.php, line 69
Class
- LingotekSourceStatus
- Provides a Lingotek source status element.
Namespace
Drupal\lingotek\ElementCode
protected function getSourceActionUrl(ContentEntityInterface &$entity, $source_status) {
$url = NULL;
if ($source_status == Lingotek::STATUS_IMPORTING) {
$url = Url::fromRoute('lingotek.entity.check_upload', [
'doc_id' => \Drupal::service('lingotek.content_translation')
->getDocumentId($entity),
], [
'query' => $this
->getDestinationWithQueryArray(),
]);
}
if ($source_status == Lingotek::STATUS_EDITED || $source_status == Lingotek::STATUS_UNTRACKED || $source_status == Lingotek::STATUS_ERROR || $source_status == Lingotek::STATUS_CANCELLED) {
if ($doc_id = \Drupal::service('lingotek.content_translation')
->getDocumentId($entity)) {
$url = Url::fromRoute('lingotek.entity.update', [
'doc_id' => $doc_id,
], [
'query' => $this
->getDestinationWithQueryArray(),
]);
}
else {
$url = Url::fromRoute('lingotek.entity.upload', [
'entity_type' => $entity
->getEntityTypeId(),
'entity_id' => $entity
->id(),
], [
'query' => $this
->getDestinationWithQueryArray(),
]);
}
}
return $url;
}