You are here

function simplenews_entity_operation in Simplenews 8

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_entity_operation()
  2. 3.x 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' && simplenews_check_node_types($entity
    ->bundle())) {
    $operations['simplenews'] = [
      'title' => t('Newsletter'),
      'url' => \Drupal\Core\Url::fromRoute('simplenews.node_tab', [
        'node' => $entity
          ->id(),
      ]),
      'weight' => 90,
    ];
  }
  return $operations;
}