forked from ZwiiCMS-Team/ZwiiCMS
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([
|
||||
'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']),
|
||||
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
|
||||
'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é
|
||||
$this->setData([
|
||||
'page',
|
||||
@ -487,8 +486,8 @@ class page extends common {
|
||||
'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
|
||||
'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
|
||||
'extraPosition' => $this->getinput('pageEditExtraPosition', helper::FILTER_BOOLEAN),
|
||||
'css' => $this->getData(['page', $pageId, 'css']),
|
||||
'js' => $this->getData(['page', $pageId, 'js'])
|
||||
'css' => $this->getData(['page', $this->getUrl(2), 'css']),
|
||||
'js' => $this->getData(['page', $this->getUrl(2), 'js'])
|
||||
]
|
||||
]);
|
||||
|
||||
@ -554,8 +553,12 @@ class page extends common {
|
||||
public function cssEditor() {
|
||||
// Soumission du formulaire
|
||||
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
|
||||
$this->setData(['page', $this->getUrl(2), 'css', $this->getInput('pageCssEditorContent') ]);
|
||||
$this->setData(['page', $this->getUrl(2), 'css', $css ]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
@ -579,8 +582,12 @@ class page extends common {
|
||||
public function jsEditor() {
|
||||
// Soumission du formulaire
|
||||
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
|
||||
$this->setData(['page', $this->getUrl(2), 'js', $this->getInput('pageJsEditorContent') ]);
|
||||
$this->setData(['page', $this->getUrl(2), 'js', $js ]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
|
@ -14,7 +14,7 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?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'
|
||||
]); ?>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user