public function EntityTypeInfo::entityOperation in Workbench Moderation 8
Same name and namespace in other branches
- 8.2 src/EntityTypeInfo.php \Drupal\workbench_moderation\EntityTypeInfo::entityOperation()
Adds an operation on bundles that should have a Moderation form.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity on which to define an operation.
Return value
array An array of operation definitions.
See also
File
- src/
EntityTypeInfo.php, line 168
Class
- EntityTypeInfo
- Service class for manipulating entity type information.
Namespace
Drupal\workbench_moderationCode
public function entityOperation(EntityInterface $entity) {
$operations = [];
$type = $entity
->getEntityType();
if ($this->moderationInfo
->isBundleForModeratableEntity($entity)) {
$operations['manage-moderation'] = [
'title' => t('Manage moderation'),
'weight' => 27,
'url' => Url::fromRoute("entity.{$type->id()}.moderation", [
$entity
->getEntityTypeId() => $entity
->id(),
]),
];
}
return $operations;
}