You are here

function content_moderation_notifications_entity_operation in Content Moderation Notifications 8.3

Implements hook_entity_operation().

File

./content_moderation_notifications.module, line 83
Hook implementations for the content moderation notifications module.

Code

function content_moderation_notifications_entity_operation(EntityInterface $entity) {
  $operations = [];
  if ($entity instanceof ContentModerationNotificationInterface) {
    if ($entity
      ->status()) {
      $operations['disable'] = [
        'title' => t('Disable'),
        'url' => $entity
          ->toUrl('disable-form'),
        'weight' => 50,
      ];
    }
    else {
      $operations['enable'] = [
        'title' => t('Enable'),
        'url' => $entity
          ->toUrl('enable-form'),
        'weight' => 50,
      ];
    }
  }
  return $operations;
}