Browse Source

Merge branch 'develop' of https://forge.laclic.fr/Laclic/SovBundle into develop

master
Fabien Normand 3 years ago
parent
commit
e3318891f6
4 changed files with 22 additions and 1 deletions
  1. +1
    -0
      Repository/AbstractRepositoryQuery.php
  2. +1
    -0
      Resources/views/admin/setting/form.html.twig
  3. +14
    -1
      Twig/StoreTwigExtension.php
  4. +6
    -0
      Twig/TwigExtension.php

+ 1
- 0
Repository/AbstractRepositoryQuery.php View File

return $this; return $this;
}*/ }*/


// @TODO : créer un addOrderBy et un orderBy
public function orderBy(string $field, string $sort = 'ASC'): self public function orderBy(string $field, string $sort = 'ASC'): self
{ {
if (strpos($field, '.')!==false) { if (strpos($field, '.')!==false) {

+ 1
- 0
Resources/views/admin/setting/form.html.twig View File

{% do form.settings.setRendered %} {% do form.settings.setRendered %}


{{ form_end(form) }} {{ form_end(form) }}

{% endblock %} {% endblock %}
{% endembed %} {% endembed %}

+ 14
- 1
Twig/StoreTwigExtension.php View File

namespace Lc\SovBundle\Twig; namespace Lc\SovBundle\Twig;


use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext; use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\SovBundle\Model\Site\SiteInterface;
use Lc\SovBundle\Repository\Reminder\ReminderStoreInterface; use Lc\SovBundle\Repository\Reminder\ReminderStoreInterface;
use Lc\SovBundle\Solver\Setting\SettingSolver;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
use Twig\Extension\AbstractExtension; use Twig\Extension\AbstractExtension;
use Twig\TwigFunction; use Twig\TwigFunction;
{ {
protected Security $security; protected Security $security;
protected ReminderStoreInterface $reminderStore; protected ReminderStoreInterface $reminderStore;
protected SettingSolver $settingSolver;


public function __construct( public function __construct(
Security $security, Security $security,
ReminderStoreInterface $reminderStore
ReminderStoreInterface $reminderStore,
SettingSolver $settingSolver
) { ) {
$this->security = $security; $this->security = $security;
$this->reminderStore = $reminderStore; $this->reminderStore = $reminderStore;
$this->settingSolver = $settingSolver;
} }


public function getFunctions() public function getFunctions()
{ {
return [ return [
new TwigFunction('sov_reminders', [$this, 'getReminders']), new TwigFunction('sov_reminders', [$this, 'getReminders']),
new TwigFunction('site_setting', [$this, 'getSiteSetting']),

]; ];
} }


return []; return [];
} }


public function getSiteSetting(SiteInterface $site, string $settingName): ?string
{
return $this->settingSolver->getSettingValue($site, $settingName);
}

public function getReminders($params) public function getReminders($params)
{ {
// @TODO : à faire // @TODO : à faire

+ 6
- 0
Twig/TwigExtension.php View File

new TwigFilter('sov_cache', [$this, 'sovCache']), new TwigFilter('sov_cache', [$this, 'sovCache']),
new TwigFilter('slugify', [$this, 'slugify']), new TwigFilter('slugify', [$this, 'slugify']),
new TwigFilter('md5', [$this, 'md5']), new TwigFilter('md5', [$this, 'md5']),
new TwigFilter('rot13', [$this, 'rot13']),
]; ];
} }


public function rot13(string $string): string
{
return str_rot13($string);
}

public function isInstanceOf(EntityInterface $entity, string $interfaceName) public function isInstanceOf(EntityInterface $entity, string $interfaceName)
{ {
$reflection = new \ReflectionClass($entity); $reflection = new \ReflectionClass($entity);

Loading…
Cancel
Save