Same name in other branches
- 2.x entity_clone.module \entity_clone_entity_operation()
Declares entity operations.
Paramètres
\Drupal\Core\Entity\EntityInterface $entity: The entity on which the linked operations will be performed.
Return value
array An operations array as returned by EntityListBuilderInterface::getOperations().
Voir aussi
\Drupal\Core\Entity\EntityListBuilderInterface::getOperations()
Fichier
-
./
entity_clone.module, line 124
Code
function entity_clone_entity_operation(EntityInterface $entity) {
if ($entity->hasLinkTemplate('clone-form') && $entity->access('clone') && !$entity->isNew()) {
return [
'clone' => [
'title' => t('Clone'),
'weight' => 50,
'url' => $entity->toUrl('clone-form')
->mergeOptions([
'query' => \Drupal::destination()->getAsArray(),
]),
],
];
}
return [];
}