JobItemListBuilder.php in Translation Management Tool 8
File
src/Entity/ListBuilder/JobItemListBuilder.php
View source
<?php
namespace Drupal\tmgmt\Entity\ListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Url;
class JobItemListBuilder extends EntityListBuilder {
protected function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if ($entity
->getCountTranslated() > 0 && $entity
->access('accept')) {
$operations['review'] = array(
'url' => $entity
->toUrl(),
'title' => t('Review'),
);
}
elseif (!$entity
->getJob()
->isUnprocessed()) {
$operations['view'] = array(
'url' => $entity
->toUrl(),
'title' => t('View'),
);
}
if ($entity
->isActive() || $entity
->isNeedsReview()) {
$operations['abort'] = array(
'url' => $entity
->toUrl('abort-form')
->setOption('query', array(
'destination' => Url::fromRoute('<current>')
->getInternalPath(),
)),
'title' => t('Abort'),
'weight' => 10,
);
}
return $operations;
}
}