Skip to content

Commit

Permalink
model section iframe-newsletter.html.twig
Browse files Browse the repository at this point in the history
  • Loading branch information
gerMdz committed Nov 16, 2021
1 parent 3f62cdf commit 04a8908
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
31 changes: 25 additions & 6 deletions src/Twig/BaseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand All @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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()];
}

}
14 changes: 14 additions & 0 deletions templates/models/sections/iframe-newsletter.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{#
# Template section script-suscripcion-newsletter.html.twig
# No necesita entradas
#}
<section class="call-to-action text-center {{ section.cssClass }}" id="{{ section.identificador }}">
<div class="container position-relative" style="background-image: url({{ section.imagePath|imagine_filter('squared_thumbnail_large') }}); background-repeat: no-repeat; background-size:cover">
{# <div class="col-sm-4 mx-auto">#}
<iframe border="0" scrolling="NO" marginheight="0px" marginwidth="0px" allowtransparency="yes"
src="{{form_suscripto_newsletter('iframe',section.linkPosting)[0]| raw }}"
{{form_suscripto_newsletter('iframe',section.linkPosting)[1]| raw }} frameborder="NO">
</iframe>
{# </div>#}
</div>
</section>

0 comments on commit 04a8908

Please sign in to comment.