protected function JobItemListBuilder::getDefaultOperations in Translation Management Tool 8
Gets this list's default operations.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.
Return value
array The array structure is identical to the return value of self::getOperations().
Overrides EntityListBuilder::getDefaultOperations
File
- src/
Entity/ ListBuilder/ JobItemListBuilder.php, line 17
Class
- JobItemListBuilder
- Provides the views data for the message entity type.
Namespace
Drupal\tmgmt\Entity\ListBuilderCode
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'),
);
}
// Display abort button on active or needs review job items.
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;
}