/** * @Route("/share", name="icap_socialmedia_share") * @ParamConverter("user", converter="current_user", options={"allowAnonymous"=true}) * @Template() * * @param Request $request * @param User $user * * @return bool */ public function shareAction(Request $request, User $user = null) { $share = new ShareAction(); $share->setUser($user); $network = $request->get('network'); $options = $this->getShareActionManager()->createShare($request, $share); $this->dispatchShareEvent($share); $response = array(); if ($network !== null) { $socialShare = new SocialShare(); $shareLink = $socialShare->getNetwork($network)->getShareLink($options['url'], array($options['title'])); $response = new RedirectResponse($shareLink); } return $response; }