public function vCardAction($person, Request $request)
 {
     /** @var VCardService $vCardService */
     $vCardService = $this->get('corporate_v_cards.vcard');
     // Get person profile
     $profile = $vCardService->getProfile($person);
     if (!$profile) {
         throw new NotFoundHttpException();
     }
     $config = $this->getParameter(CorporateVCardsBundle::$conf_prefix . '.config');
     // Get random background
     $backgrounds = $config['backgrounds'];
     $background = $backgrounds[rand(0, count($backgrounds) - 1)];
     // Check if mails are enabled
     $formView = null;
     $mailSent = false;
     $recipientVcardLink = null;
     $mailsServiceName = $config['mails_service'];
     if (!!$mailsServiceName) {
         // Send by mail form
         $formBuilder = $this->createFormBuilder()->add('email', EmailType::class, ['attr' => ['placeholder' => 'Adresse e-mail'], 'required' => true])->add('submit', SubmitType::class, ['label' => 'Envoyer']);
         $form = $formBuilder->getForm();
         $form->handleRequest($request);
         $formView = $form->createView();
         if ($form->isSubmitted() && $form->isValid()) {
             // Send e-mail
             /** @var MailsServiceInterface $mailsService */
             $mailsService = $this->get(substr($mailsServiceName, 1));
             $email = $form->get('email')->getData();
             $mailsService->sendVcard($email, $profile, $person);
             // Generate vcard download link from user e-mail address
             $infos = Util::getContactInformationFromEmailAddress($email);
             $recipientVcardLink = $this->get('router')->generate('vcard_download_frominfos', array_merge(['person' => $person], $infos));
             $mailSent = true;
         }
     }
     // Generate favicons public path base
     $faviconsPath = $config['favicons']['enabled'] ? Util::getPublicDir($config['favicons']['dir']) : null;
     return $this->render('@CorporateVCards/vcard.html.twig', ['person' => $person, 'profile' => $profile, 'background' => $background, 'mailsEnabled' => $mailsServiceName != null, 'mailSent' => $mailSent, 'recipientVcardLink' => $recipientVcardLink, 'form' => $formView, 'config' => $config, 'favicons_path_base' => $faviconsPath]);
 }