function simplenews_entity_operation in Simplenews 3.x
Same name and namespace in other branches
- 8.2 simplenews.module \simplenews_entity_operation()
- 8 simplenews.module \simplenews_entity_operation()
Implements hook_entity_operation().
File
- ./
simplenews.module, line 154 - Simplenews node handling, sent email, newsletter block and general hooks.
Code
function simplenews_entity_operation(EntityInterface $entity) {
$operations = [];
if ($entity
->getEntityTypeId() == 'node') {
$url = Url::fromRoute('simplenews.node_tab', [
'node' => $entity
->id(),
]);
if ($url
->access()) {
$operations['simplenews'] = [
'title' => t('Newsletter'),
'url' => $url,
'weight' => 90,
];
}
}
return $operations;
}