Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
AbstractCompositionItem.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Space\Toolbar\Composition
;
4
5
use
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\BusinessProcess
;
6
use
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\CalendarEvent
;
7
use
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\ListElement
;
8
use
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\Message
;
9
use
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\Task
;
10
11
abstract
class
AbstractCompositionItem
12
{
13
protected
string
$moduleId
=
''
;
14
15
public
static
function
createFromModuleId(
string
$moduleId
): ?static
16
{
18
$class = static::getClass(
$moduleId
);
19
if
(is_null($class))
20
{
21
return
null
;
22
}
23
24
return
new
$class();
25
}
26
27
public
function
getModuleId
(): string
28
{
29
return
$this->moduleId
;
30
}
31
public
function
isHidden
(): bool
32
{
33
return
false
;
34
}
35
36
public
function
getBoundItem
(): ?
AbstractCompositionItem
37
{
38
return
null
;
39
}
40
41
public
function
hasBoundItem
(): bool
42
{
43
return
!is_null($this->
getBoundItem
());
44
}
45
46
private
static
function
getClass(
string
$moduleId
): ?string
47
{
48
return
match (
$moduleId
)
49
{
50
'bizproc'
=> BusinessProcess::class,
51
'calendar'
=> CalendarEvent::class,
52
'lists'
=> ListElement::class,
53
'blog'
=> Message::class,
54
'tasks'
=> Task::class,
55
default
=>
null
,
56
};
57
}
58
}
Bitrix\Socialnetwork\Space\Toolbar\Composition\AbstractCompositionItem
Definition
AbstractCompositionItem.php:12
Bitrix\Socialnetwork\Space\Toolbar\Composition\AbstractCompositionItem\$moduleId
string $moduleId
Definition
AbstractCompositionItem.php:13
Bitrix\Socialnetwork\Space\Toolbar\Composition\AbstractCompositionItem\getBoundItem
getBoundItem()
Definition
AbstractCompositionItem.php:36
Bitrix\Socialnetwork\Space\Toolbar\Composition\AbstractCompositionItem\getModuleId
getModuleId()
Definition
AbstractCompositionItem.php:27
Bitrix\Socialnetwork\Space\Toolbar\Composition\AbstractCompositionItem\isHidden
isHidden()
Definition
AbstractCompositionItem.php:31
Bitrix\Socialnetwork\Space\Toolbar\Composition\AbstractCompositionItem\hasBoundItem
hasBoundItem()
Definition
AbstractCompositionItem.php:41
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\BusinessProcess
Definition
BusinessProcess.php:8
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\CalendarEvent
Definition
CalendarEvent.php:8
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\ListElement
Definition
ListElement.php:8
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\Message
Definition
Message.php:8
Bitrix\Socialnetwork\Space\Toolbar\Composition\Item\Task
Definition
Task.php:8
Bitrix\Socialnetwork\Space\Toolbar\Composition
Definition
AbstractCompositionItem.php:3
modules
socialnetwork
lib
Space
Toolbar
Composition
AbstractCompositionItem.php
Создано системой
1.10.0