<?phpnamespace App\Twig;use App\Services\Core\Core;use App\Services\Pages\Templates;use Twig\Extension\AbstractExtension;use Twig\TwigFunction;class PagesExtension extends AbstractExtension{ public function __construct(Core $core, Templates $templates ) { $this->core = $core; $this->templates = $templates; } /** * {@inheritdoc} */ public function getFunctions(): array { return [ new TwigFunction('numbersOfCharacters', array($this, 'numbersOfCharacters')), new TwigFunction('getSaveHTML', array($this, 'getSaveHTML')), new TwigFunction('getPageHasLanguages', array($this, 'getPageHasLanguages')), new TwigFunction('getPagesHasLocale', array($this, 'getPagesHasLocale')), new TwigFunction('getPathPageHasLanguages', array($this, 'getPathPageHasLanguages')), new TwigFunction('autosummary', array($this, 'autosummary')), new TwigFunction('autosummaryID', array($this, 'autosummaryID')), new TwigFunction('getPathArticleLocale', array($this, 'getPathArticleLocale')), ]; } public function getPathArticleLocale($locale,$identifiant) { return $this->fiches->getArticleIdentifiant($locale,$identifiant); } public function numbersOfCharacters($chain) { return $this->core->numbersOfCharacters($chain); } public function getSaveHTML($saveTemplate) { return $this->templates->getSaveHTML($saveTemplate); } public function getPageHasLanguages($pageID,$language) { $queries = $this->templates->getPageHasLanguages($pageID,$language); if(!empty($queries)) { return $queries; } return null; } public function getPagesHasLocale($language) { return $this->templates->getPagesHasLocale($language); } public function getPathPageHasLanguages($pageID,$language) { return $this->templates->getPathPageHasLanguages($pageID,$language); } public function autosummary($html) { return $this->templates->autosummary($html); } public function autosummaryID($html) { return $this->templates->autosummaryID($html); }}