public function MentionsController::mentionPermalink in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 8.2 modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 8.3 modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 8.4 modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 8.5 modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 8.6 modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 8.7 modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 8.8 modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 10.3.x modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 10.0.x modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 10.1.x modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
- 10.2.x modules/custom/mentions/src/MentionsController.php \Drupal\mentions\MentionsController::mentionPermalink()
Redirects mention links to the correct page depending on entity context.
Taken from: commentPermalink.
Parameters
\Drupal\mentions\MentionsInterface $mentions: A mention entity.
Return value
\Symfony\Component\HttpFoundation\Response The mention listing set to the page on which the mention appears.
Throws
\Symfony\Component\HttpKernel\Exception\NotFoundHttpException
\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
1 string reference to 'MentionsController::mentionPermalink'
- mentions.routing.yml in modules/
custom/ mentions/ mentions.routing.yml - modules/custom/mentions/mentions.routing.yml
File
- modules/
custom/ mentions/ src/ MentionsController.php, line 31
Class
- MentionsController
- Controller for the mentions entity.
Namespace
Drupal\mentionsCode
public function mentionPermalink(MentionsInterface $mentions) {
if ($entity = $mentions
->getMentionedEntity()) {
// Check access permissions for the entity.
if (!$entity
->access('view')) {
throw new AccessDeniedHttpException();
}
$entity_url = $entity
->toUrl('canonical');
return new RedirectResponse($entity_url
->setAbsolute()
->toString());
}
throw new NotFoundHttpException();
}