<?phpnamespace App\Twig;use App\Services\Core\Core;use App\Services\Pages\Fiches;use App\Services\Pages\Templates;use Twig\Extension\AbstractExtension;use Twig\TwigFunction;use Twig\TwigFilter;class PagesExtension extends AbstractExtension{ public function __construct(Core $core, Templates $templates, Fiches $fiches ) { $this->core = $core; $this->templates = $templates; $this->fiches = $fiches; } /** * {@inheritdoc} */ public function getFunctions(): array { return [ new TwigFunction('getTemplatesFormSubItems', array($this, 'getTemplatesFormSubItems')), new TwigFunction('getExtensionFilename', array($this, 'getExtensionFilename')), new TwigFunction('numbersOfCharacters', array($this, 'numbersOfCharacters')), new TwigFunction('getCountInteractions', array($this, 'getCountInteractions')), new TwigFunction('getSaveHTML', array($this, 'getSaveHTML')), new TwigFunction('cleanSourcecodeHTML', array($this, 'cleanSourcecodeHTML')), new TwigFunction('cleanQcmHTML', array($this, 'cleanQcmHTML')), new TwigFunction('getSimulationCategoryItems', array($this, 'getSimulationCategoryItems')), new TwigFunction('getArticleAriane', array($this, 'getArticleAriane')), 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('getPageIdentifiant', array($this, 'getPageIdentifiant')), new TwigFunction('getPathArticleLocale', array($this, 'getPathArticleLocale')), ]; } public function getPathArticleLocale($locale,$identifiant) { return $this->fiches->getArticleIdentifiant($locale,$identifiant); } public function getArticleAriane($folderslug,$folderslug2 = null,$folderslug3 = null) { return $this->fiches->getArticleAriane($folderslug,$folderslug2,$folderslug3); } public function getSimulationCategoryItems($categoryID) { return $this->fiches->getSimulationItems($categoryID); } public function cleanSourcecodeHTML($html) { return $this->templates->cleanSourcecodeHTML($html); } public function cleanQcmHTML($html) { return $this->templates->cleanQcmHTML($html); } public function getExtensionFilename($text) { return $this->core->extension($text); } public function numbersOfCharacters($chain) { return $this->core->numbersOfCharacters($chain); } public function getTemplatesFormSubItems($item) { return $this->templates->getTemplatesFormSubItems($item); } public function getSaveHTML($saveTemplate) { return $this->templates->getSaveHTML($saveTemplate); } public function getCountInteractions($interactionID) { return $this->fiches->getCountInteractions($interactionID); } 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 getPageIdentifiant($identifiant, $locale = "en") { return $this->templates->getPageIdentifiant($identifiant,$locale); } public function autosummary($html) { return $this->templates->autosummary($html); } public function autosummaryID($html) { return $this->templates->autosummaryID($html); }}