Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
boardbutton.php
1<?php
2
4
5use Bitrix\Main\Page\Asset;
6
8{
9 private $html = '';
10 private $jsList = [];
11 private $cssList = [];
12 private $stringList = [];
13
14
15 public function __construct($html)
16 {
17 $this->setHtml($html);
18 }
19
20 public function getHtml()
21 {
22 return $this->html;
23 }
24
25 public function setHtml($html)
26 {
27 $this->html = $html;
28 }
29
30 public function getJsList()
31 {
32 return $this->jsList;
33 }
34
35 public function setJsList(array $jsList)
36 {
37 $this->jsList = $jsList;
38 }
39
40
41 public function addJs($jsPath)
42 {
43 $this->jsList[] = $jsPath;
44 }
45
46
47 public function getStringList()
48 {
49 return $this->stringList;
50 }
51
52 public function setStringList(array $stringList)
53 {
54 $this->stringList = $stringList;
55 }
56
57
58 public function addString($string)
59 {
60 $this->stringList[] = $string;
61 }
62
63
64 public function getCssList()
65 {
66 return $this->cssList;
67 }
68
69
70 public function setCssList(array $cssList)
71 {
72 $this->cssList = $cssList;
73 }
74
75 public function addCss($jsPath)
76 {
77 $this->jsList[] = $jsPath;
78 }
79
80 public function process()
81 {
82 return $this;
83 }
84
85 public function flush()
86 {
87 foreach ($this->getJsList() as $jsPath)
88 {
89 Asset::getInstance()->addJs($jsPath);
90 }
91
92 foreach ($this->getCssList() as $cssPath)
93 {
94 Asset::getInstance()->addCss($cssPath);
95 }
96
97 echo implode('', $this->getStringList());
98 echo $this->getHtml();
99
100 }
101}