Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
intranetbindingmenu.php
1<?php
2
3namespace Bitrix\UI\Buttons;
4
6
8{
9 protected $componentParameters = [];
10 protected $content;
11
12 public static function isAvailable(): bool
13 {
14 return Loader::includeModule('intranet');
15 }
16
17 public static function createByComponentParameters(array $parameters): ?self
18 {
19 if(!static::isAvailable())
20 {
21 return null;
22 }
23
24 return new static([
25 'componentParameters' => $parameters,
26 ]);
27 }
28
29 protected function init(array $params = [])
30 {
31 $this->componentParameters = $params['componentParameters'] ?? [];
32
33 $this->content = $this->preRender();
34 }
35
36 protected function preRender(): string
37 {
38 $result = '';
39
40 if(empty($this->componentParameters))
41 {
42 return $result;
43 }
44
45 global $APPLICATION;
46 ob_start();
47 $APPLICATION->IncludeComponent(
48 'bitrix:intranet.binding.menu',
49 '',
50 $this->componentParameters
51 );
52 $result = ob_get_contents();
53 ob_end_clean();
54
55 return $result;
56 }
57
58 public function render($jsInit = true): string
59 {
60 return $this->content;
61 }
62}
static createByComponentParameters(array $parameters)