You are here

public function SocialCommentController::redirectToOriginalEntity in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  2. 8.2 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  3. 8.3 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  4. 8.4 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  5. 8.5 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  6. 8.6 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  7. 8.7 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  8. 8.8 modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  9. 10.3.x modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  10. 10.0.x modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  11. 10.1.x modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()
  12. 10.2.x modules/social_features/social_comment/src/Controller/SocialCommentController.php \Drupal\social_comment\Controller\SocialCommentController::redirectToOriginalEntity()

Redirects to the original entity when conditions are met.

Parameters

\Drupal\Core\Url $url: The canonical url.

\Drupal\comment\CommentInterface $comment: The comment interface.

\Drupal\Core\Entity\Entity $entity: The Entity to redirect to.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse Returns the Redirect Response.

2 calls to SocialCommentController::redirectToOriginalEntity()
PostCommentController::getReplyForm in modules/social_features/social_post/src/Controller/PostCommentController.php
Form constructor for the comment reply form.
SocialCommentController::commentPermalink in modules/social_features/social_comment/src/Controller/SocialCommentController.php
Redirects comment links to the correct page depending on permissions.

File

modules/social_features/social_comment/src/Controller/SocialCommentController.php, line 52

Class

SocialCommentController
Controller routine override to change relevant bits in the password reset.

Namespace

Drupal\social_comment\Controller

Code

public function redirectToOriginalEntity(Url $url, CommentInterface $comment = NULL, Entity $entity = NULL) {
  $options = [];
  if (isset($comment)) {
    $options = [
      'fragment' => 'comment-' . $comment
        ->id(),
    ];
  }
  return $this
    ->redirect($url
    ->getRouteName(), $url
    ->getRouteParameters(), $options);
}