Bläddra i källkod

Refactoring frontend

develop
Guillaume 3 år sedan
förälder
incheckning
63a626df1c
3 ändrade filer med 25 tillägg och 17 borttagningar
  1. +5
    -0
      Repository/Site/SiteStore.php
  2. +5
    -5
      Twig/MetaTwigExtension.php
  3. +15
    -12
      Twig/TwigExtension.php

+ 5
- 0
Repository/Site/SiteStore.php Visa fil

@@ -29,4 +29,9 @@ class SiteStore extends AbstractStore implements SiteStoreInterface
{
return $query;
}

public function getOneDefault()
{
return $this->getOneByDevAlias('default');
}
}

+ 5
- 5
Twig/MetaTwigExtension.php Visa fil

@@ -31,27 +31,27 @@ class MetaTwigExtension extends AbstractExtension
return [];
}

public function getMetaTitle($entity): string
public function getMetaTitle($entity): ?string
{
return $this->metaComponent->getMetaTitle($entity);
}

public function getMetaDescription($entity): string
public function getMetaDescription($entity): ?string
{
return $this->metaComponent->getMetaDescription($entity);
}

public function getOpenGraphTitle($entity): string
public function getOpenGraphTitle($entity): ?string
{
return $this->metaComponent->getOpenGraphTitle($entity);
}

public function getOpenGraphDescription($entity): string
public function getOpenGraphDescription($entity): ?string
{
return $this->metaComponent->getOpenGraphDescription($entity);
}

public function getOpenGraphImage($entity): string
public function getOpenGraphImage($entity): ?string
{
return $this->metaComponent->getOpenGraphImage($entity);
}

+ 15
- 12
Twig/TwigExtension.php Visa fil

@@ -7,6 +7,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Component\MetaComponent;
use Lc\SovBundle\Component\StringComponent;
use Lc\SovBundle\Form\Newsletter\NewsletterType;
use Lc\SovBundle\Model\File\FileInterface;
use Lc\SovBundle\Repository\Reminder\ReminderStore;
use Lc\SovBundle\Translation\TranslatorAdmin;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
@@ -23,18 +24,19 @@ use Twig\TwigFunction;

class TwigExtension extends AbstractExtension
{
protected $em;
protected $kernel;
protected $parameterBag;
protected $cacheManager;
protected $requestStack;
protected $router;
protected $translator;
protected $translatorAdmin;
protected $reminderStore;
protected $security;
protected EntityManagerInterface $em;
protected KernelInterface $kernel;
protected ParameterBagInterface $parameterBag;
protected CacheManager $cacheManager;
protected RequestStack $requestStack;
protected UrlGeneratorInterface $router;
protected TranslatorInterface $translator;
protected TranslatorAdmin $translatorAdmin;
protected ReminderStore $reminderStore;
protected Security $security;
protected FormFactoryInterface $formFactory;
protected StringComponent $stringComponent;
protected MetaComponent $metaComponent;

public function __construct(
KernelInterface $kernel,
@@ -70,6 +72,7 @@ class TwigExtension extends AbstractExtension
{
return [
new TwigFunction('sov_liip', [$this, 'liip']),
new TwigFunction('liip', [$this, 'liip']),
new TwigFunction('sov_get_by_devalias', [$this, 'getByDevAlias']),
new TwigFunction('sov_parameter', [$this, 'getParameter']),
new TwigFunction('sov_homepage_route', [$this, 'getHomepageRoute']),
@@ -128,7 +131,7 @@ class TwigExtension extends AbstractExtension
$fileManagerFolder = substr($this->getFileManagerFolder(), 1);

if (strpos($path, $fileManagerFolder) === false) {
$path = $fileManagerFolder.'/'.$path;
$path = $fileManagerFolder . '/' . $path;
}

if (file_exists($path)) {
@@ -136,7 +139,7 @@ class TwigExtension extends AbstractExtension
}
}

return $this->cacheManager->getBrowserPath($this->getFileManagerFolder().'/'.$default, $thumb);
return $this->cacheManager->getBrowserPath($this->getFileManagerFolder() . '/' . $default, $thumb);
}

public function getFileManagerFolder()

Laddar…
Avbryt
Spara