Contenu avancé des pages (css et js)
This commit is contained in:
parent
0df34177ca
commit
4a8e2ff541
|
@ -2785,8 +2785,10 @@ class core extends common {
|
||||||
) {
|
) {
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
//'content' => file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(0), 'content'])),
|
'content' => $this->getPage($this->getUrl(0), self::$i18n) .
|
||||||
'content' => $this->getPage($this->getUrl(0), self::$i18n),
|
// Concatène avec les paramètres avancés.
|
||||||
|
$this->getData(['page', $this->getUrl(0), 'css']) .
|
||||||
|
$this->getData(['page', $this->getUrl(0), 'js']),
|
||||||
'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']),
|
'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']),
|
||||||
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
|
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
|
||||||
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
|
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
|
||||||
|
|
|
@ -457,7 +457,6 @@ class page extends common {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modifie la page ou en crée une nouvelle si l'id a changé
|
// Modifie la page ou en crée une nouvelle si l'id a changé
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'page',
|
'page',
|
||||||
|
@ -487,8 +486,8 @@ class page extends common {
|
||||||
'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
|
'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
|
||||||
'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
|
'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
|
||||||
'extraPosition' => $this->getinput('pageEditExtraPosition', helper::FILTER_BOOLEAN),
|
'extraPosition' => $this->getinput('pageEditExtraPosition', helper::FILTER_BOOLEAN),
|
||||||
'css' => $this->getData(['page', $pageId, 'css']),
|
'css' => $this->getData(['page', $this->getUrl(2), 'css']),
|
||||||
'js' => $this->getData(['page', $pageId, 'js'])
|
'js' => $this->getData(['page', $this->getUrl(2), 'js'])
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -554,8 +553,12 @@ class page extends common {
|
||||||
public function cssEditor() {
|
public function cssEditor() {
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if($this->isPost()) {
|
||||||
|
// Contrôle la présence des balises
|
||||||
|
$css =$this->getInput('pageCssEditorContent');
|
||||||
|
$css = strpos ( $css, '<style>') >= 1 ? $css : '<style>' . $css;
|
||||||
|
$css = strpos ( $css, '</style>') >= 1 ? $css : $css . '</style>';
|
||||||
// Enregistre le CSS
|
// Enregistre le CSS
|
||||||
$this->setData(['page', $this->getUrl(2), 'css', $this->getInput('pageCssEditorContent') ]);
|
$this->setData(['page', $this->getUrl(2), 'css', $css ]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'notification' => 'Modifications enregistrées',
|
'notification' => 'Modifications enregistrées',
|
||||||
|
@ -579,8 +582,12 @@ class page extends common {
|
||||||
public function jsEditor() {
|
public function jsEditor() {
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if($this->isPost()) {
|
||||||
|
// Contrôle la présence des balises
|
||||||
|
$js = $this->getInput('pageJsEditorContent');
|
||||||
|
$js = strpos ( $css, '<script>') >=1 ? $js : '<script>' . $js;
|
||||||
|
$js = strpos ( $css, '</script>') >=1 ? $js : $js . '</script>';
|
||||||
// Enregistre le JS
|
// Enregistre le JS
|
||||||
$this->setData(['page', $this->getUrl(2), 'js', $this->getInput('pageJsEditorContent') ]);
|
$this->setData(['page', $this->getUrl(2), 'js', $js ]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'notification' => 'Modifications enregistrées',
|
'notification' => 'Modifications enregistrées',
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php echo template::textarea('pageCssEditorContent', [
|
<?php echo template::textarea('pageCssEditorContent', [
|
||||||
'value' => $this->getData(['page', $this->getUrl(2), 'css' ]),
|
'value' => empty($this->getData(['page', $this->getUrl(2), 'css' ])) ? '<style></style>': $this->getData(['page', $this->getUrl(2), 'css' ]),
|
||||||
'class' => 'editor'
|
'class' => 'editor'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue