You are here

public function CommentNotifyController::disable in Comment Notify 8

Creates a page for disabling notifications.

Parameters

string $hash: A hash identifying the notification entry to disable.

Return value

array A renderable array.

1 string reference to 'CommentNotifyController::disable'
comment_notify.routing.yml in ./comment_notify.routing.yml
comment_notify.routing.yml

File

src/Controller/CommentNotifyController.php, line 21

Class

CommentNotifyController
Default controller for the comment_notify module.

Namespace

Drupal\comment_notify\Controller

Code

public function disable($hash) {
  module_load_include('inc', 'comment_notify', 'comment_notify');
  if (comment_notify_unsubscribe_by_hash($hash)) {
    return [
      '#markup' => $this
        ->t('Your comment follow-up notification for this post was disabled. Thanks.'),
    ];
  }
  else {
    return [
      '#markup' => $this
        ->t('Sorry, there was a problem unsubscribing from notifications.'),
    ];
  }
}