public function SocialCommentController::commentPermalink in Open Social 8
Same name and namespace in other branches
- 8.9 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 8.2 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 8.3 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 8.4 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 8.5 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 8.6 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 8.7 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 8.8 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 10.3.x modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 10.0.x modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 10.1.x modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
- 10.2.x modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::commentPermalink()
Redirects comment links to the correct page depending on permissions.
@inheritdoc
Overrides CommentController::commentPermalink
File
- modules/
social_features/ social_comment/ src/ Controller/ SocialCommentController.php, line 23
Class
- SocialCommentController
- Controller routine override to change relevant bits in the password reset.
Namespace
Drupal\social_comment\ControllerCode
public function commentPermalink(Request $request, CommentInterface $comment) {
if ($entity = $comment
->getCommentedEntity()) {
// Check access permissions for the entity.
/* @var \Drupal\Core\Entity\Entity $entity */
if (!$entity
->access('view')) {
throw new AccessDeniedHttpException();
}
/* @var \Drupal\Core\Url $url */
if ($url = $entity
->urlInfo('canonical')) {
// Redirect the user to the correct entity.
return $this
->redirectToOriginalEntity($url, $comment, $entity);
}
}
throw new NotFoundHttpException();
}