Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
StubProcessor.php
1
<?php
2
3
namespace
Bitrix\UI\Admin\Page
;
4
5
use
Bitrix\Main\Config\Option
;
6
use
Bitrix\Main\Context
;
7
use CMain;
8
24
class
StubProcessor
25
{
26
private
const
OPTION_SKIPED_PAGES =
'skip_stub_pages'
;
27
35
public
function
addSkippedPage
(
string
$page): void
36
{
37
$pages = $this->getSkippedPages();
38
$pages[$page] =
true
;
39
40
Option::set(
'ui'
, self::OPTION_SKIPED_PAGES, json_encode($pages));
41
}
42
48
private
function
getSkippedPages(): array
49
{
50
$pages = Option::get(
'ui'
, self::OPTION_SKIPED_PAGES);
51
if
(!empty($pages))
52
{
53
$pages = json_decode($pages,
true
);
54
if
(is_array($pages))
55
{
56
return
$pages;
57
}
58
}
59
60
return
[];
61
}
62
70
public
function
isShowStub
(?
string
$page =
null
): bool
71
{
72
$page ??=
Context::getCurrent
()->getRequest()->getRequestedPage();
73
$skippedPages = $this->getSkippedPages();
74
75
return
!isset($skippedPages[$page]);
76
}
77
86
public
function
showStub(
string
$title, ?
string
$linkToNewPage): void
87
{
88
global $APPLICATION;
89
94
$APPLICATION->IncludeComponent(
'bitrix:ui.admin.page.stub'
,
''
, [
95
'TITLE'
=> $title,
96
'STUB_PROCESSOR'
=> $this,
97
'LINK_TO_NEW_PAGE'
=> $linkToNewPage,
98
]);
99
}
100
}
Bitrix\Main\Config\Option
Definition
option.php:15
Bitrix\Main\Context\getCurrent
static getCurrent()
Definition
context.php:241
Bitrix\UI\Admin\Page\StubProcessor
Definition
StubProcessor.php:25
Bitrix\UI\Admin\Page\StubProcessor\addSkippedPage
addSkippedPage(string $page)
Definition
StubProcessor.php:35
Bitrix\UI\Admin\Page\StubProcessor\isShowStub
isShowStub(?string $page=null)
Definition
StubProcessor.php:70
Bitrix\Main\Context
Definition
culture.php:9
Bitrix\UI\Admin\Page
Definition
StubProcessor.php:3
modules
ui
lib
Admin
Page
StubProcessor.php
Создано системой
1.10.0