Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
AbstractCompositionItem.php
1<?php
2
4
10
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
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}