1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
typefactory.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\UserField\Internal;
4
8abstract class TypeFactory
9{
10 protected $itemEntities = [];
11
15 abstract public function getTypeDataClass(): string;
16
20 abstract public function getItemPrototypeDataClass(): string;
21
22 abstract public function getCode(): string;
23
28 public function getItemDataClass($type): string
29 {
30 return $this->getItemEntity($type)->getDataClass();
31 }
32
34 {
35 $typeData = $this->getTypeDataClass()::resolveType($type);
36 if(!empty($typeData) && isset($this->itemEntities[$typeData['ID']]))
37 {
38 return $this->itemEntities[$typeData['ID']];
39 }
40
41 $entity = $this->getTypeDataClass()::compileEntity($type);
42 $this->itemEntities[$typeData['ID']] = $entity;
43
44 return $entity;
45 }
46
50 public function getItemParentClass(): string
51 {
52 return Item::class;
53 }
54
55 public function getUserFieldEntityPrefix(): string
56 {
57 $code = $this->getCode();
58 return static::getPrefixByCode($code).'_';
59 }
60
61 public function getUserFieldEntityId(int $typeId): string
62 {
63 return $this->getUserFieldEntityPrefix().$typeId;
64 }
65
66 public static function getCodeByPrefix(string $prefix): string
67 {
68 return mb_strtolower($prefix);
69 }
70
71 public static function getPrefixByCode(string $code): string
72 {
73 return mb_strtoupper($code);
74 }
75
76 public function prepareIdentifier($identifier)
77 {
78 return (int)$identifier;
79 }
80}
$type
Определения options.php:106
prepareIdentifier($identifier)
Определения typefactory.php:76
static getPrefixByCode(string $code)
Определения typefactory.php:71
getUserFieldEntityId(int $typeId)
Определения typefactory.php:61
static getCodeByPrefix(string $prefix)
Определения typefactory.php:66
$entity
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
Определения ufield.php:9