LocalTaskItemListBuilder.php in Translation Management Tool 8
File
translators/tmgmt_local/src/Entity/ListBuilder/LocalTaskItemListBuilder.php
View source
<?php
namespace Drupal\tmgmt_local\Entity\ListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
class LocalTaskItemListBuilder extends EntityListBuilder {
protected function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if ($entity
->access('view', \Drupal::currentUser()) && $entity
->getTask()
->getAssignee() && $entity
->getTask()
->getAssignee()
->id() == \Drupal::currentUser()
->id()) {
if ($entity
->isPending()) {
$operations['translate'] = [
'url' => $entity
->toUrl(),
'title' => t('Translate'),
'weight' => 0,
];
}
else {
$operations['view'] = [
'url' => $entity
->toUrl(),
'title' => t('View'),
'weight' => 0,
];
}
}
return $operations;
}
}