From 04a890821e195fa6bae898ad1ecef1da40ecfc0a Mon Sep 17 00:00:00 2001 From: "Gerardo J. Montivero" Date: Tue, 16 Nov 2021 13:36:22 -0300 Subject: [PATCH] model section iframe-newsletter.html.twig --- src/Twig/BaseExtension.php | 31 +++++++++++++++---- .../sections/iframe-newsletter.html.twig | 14 +++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 templates/models/sections/iframe-newsletter.html.twig diff --git a/src/Twig/BaseExtension.php b/src/Twig/BaseExtension.php index 7d717346..baa8a5d5 100755 --- a/src/Twig/BaseExtension.php +++ b/src/Twig/BaseExtension.php @@ -59,14 +59,14 @@ public function getFunctions(): array ]; } - public function lema() + public function lema(): ?string { $lema = $this->em->getRepository(IndexAlameda::class)->findOneBy(['base' => 'index']); return $lema->getLema(); } - public function metaDescripcion() + public function metaDescripcion(): ?string { $base = $this->em->getRepository(IndexAlameda::class)->findOneBy(['base' => 'index']); @@ -88,7 +88,7 @@ public function getUploadedAssetPath(string $path): string ->getPublicPath($path); } - public function capacidad_restante(string $celebracion, int $cantidad) + public function capacidad_restante(string $celebracion, int $cantidad): int { $invitados = $this->container->get(EntityManagerInterface::class)->getRepository(Invitado::class)->countByCelebracion($celebracion); return $cantidad - $invitados; @@ -99,7 +99,7 @@ public function capacidad_ocupada(string $celebracion) return $this->container->get(EntityManagerInterface::class)->getRepository(Invitado::class)->countByCelebracion($celebracion); } - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return [ UploaderHelper::class, @@ -162,12 +162,18 @@ private function addTexto($valor): string return sprintf($texto, $valor, $valor, $valor, $valor); } - public function form_suscripto_newsletter(string $type,string $fuente): string + /** + * @param string $type + * @param string $fuente + * @return array|string|void + */ + public function form_suscripto_newsletter(string $type,string $fuente) { switch ($type){ case 'script': - default: return $this->divScript($fuente); + case 'iframe': + return $this->divIframe($fuente); } } @@ -184,4 +190,17 @@ protected function divScript(string $fuente): string return $crea_formulario[0]->getSrcCodigo(); } + /** + * @param string $fuente + * @return array + */ + protected function divIframe(string $fuente): array + { + $crea_formulario = $this->container->get(EntityManagerInterface::class) + ->getRepository(NewsSite::class) + ->findBy(['srcType' =>'iframe', 'srcSite' => $fuente]); + + return [$crea_formulario[0]->getSrcCodigo(),$crea_formulario[0]->getSrcParameters()]; + } + } diff --git a/templates/models/sections/iframe-newsletter.html.twig b/templates/models/sections/iframe-newsletter.html.twig new file mode 100644 index 00000000..97943a46 --- /dev/null +++ b/templates/models/sections/iframe-newsletter.html.twig @@ -0,0 +1,14 @@ +{# +# Template section script-suscripcion-newsletter.html.twig +# No necesita entradas +#} +
+
+{#
#} + +{#
#} +
+
\ No newline at end of file