function quick_node_clone_entity_operation in Quick Node Clone 8
Implements hook_entity_operation().
File
- ./
quick_node_clone.module, line 28 - Contains quick_node_clone.module.
Code
function quick_node_clone_entity_operation(EntityInterface $entity) {
$operations = [];
// Only add an operation for node entities.
if ($entity
->getEntityTypeId() !== 'node') {
return $operations;
}
if (!_quick_node_clone_has_clone_permission($entity)) {
return $operations;
}
$operations['quick_clone'] = [
'title' => t('Clone'),
'weight' => '100',
'url' => Url::fromRoute('quick_node_clone.node.quick_clone', [
'node' => $entity
->id(),
]),
];
return $operations;
}