Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
cssblock.php
1<?php
3
4use \Bitrix\Landing\Field;
5use \Bitrix\Main\Localization\Loc;
6
7Loc::loadMessages(__FILE__);
8
10{
15 protected function getMap()
16 {
17 return array(
18 'USE' => new Field\Checkbox('USE', array(
19 'title' => Loc::getMessage('LANDING_HOOK_CSSLOCK_USE')
20 )),
21 'CODE' => new Field\Textarea('CODE', array(
22 'title' => Loc::getMessage('LANDING_HOOK_HEADBLOCK_CSS_CODE'),
23 'help' => Loc::getMessage('LANDING_HOOK_HEADBLOCK_CSS_CODE_HELP2'),
24 'placeholder' => '* {display: none;}'
25 )),
26 'FILE' => new Field\Textarea('FILE', array(
27 'title' => Loc::getMessage('LANDING_HOOK_HEADBLOCK_CSS_FILE')
28 ))
29 );
30 }
31
36 public function getTitle()
37 {
38 return Loc::getMessage('LANDING_HOOK_CSSBLOCK_NAME');
39 }
40
45 public function getSort()
46 {
47 return 500;
48 }
49
54 public function enabled()
55 {
56 if ($this->issetCustomExec())
57 {
58 return true;
59 }
60
61 return $this->fields['USE']->getValue() == 'Y';
62 }
63
68 public function enabledInEditMode()
69 {
70 return false;
71 }
72
77 public function exec()
78 {
79 if ($this->execCustom())
80 {
81 return;
82 }
83
84 $cssCode = trim($this->fields['CODE']);
85 $cssFile = trim($this->fields['FILE']);
86
87 if ($cssCode != '')
88 {
89 echo '<style type="text/css">' . $cssCode . '</style>';
90 }
91 if ($cssFile != '')
92 {
93 echo '<link href="' . \htmlspecialcharsbx($cssFile) . '" type="text/css" rel="stylesheet" />';
94 }
95 }
96}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29