/** * @param string $name * * @return boolean */ protected function variantExists(Font $font, $entityManager) { $entity = $entityManager->getRepository('RZ\\Roadiz\\Core\\Entities\\Font')->findOneBy(['name' => $font->getName(), 'variant' => $font->getVariant()]); return null !== $entity; }
/** * Build delete font form with name constraint. * @param RZ\Roadiz\Core\Entities\Font $font * * @return \Symfony\Component\Form\Form */ protected function buildDeleteForm(Font $font) { $builder = $this->createFormBuilder()->add('fontId', 'hidden', ['data' => $font->getId()]); return $builder->getForm(); }
/** * Get CSS font-face properties for current font. * * @param CsrfTokenManagerInterface $csrfTokenManager * * @return string CSS output */ public function getCSSFontFace(CsrfTokenManagerInterface $csrfTokenManager) { $assignation = ['font' => $this->font, 'site' => SettingsBag::get('site_name'), 'fontFolder' => '/' . Font::getFilesFolderName(), 'csrfTokenManager' => $csrfTokenManager]; return $this->getTwig()->render('fonts/fontfamily.css.twig', $assignation); }