Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
template.php
1<?php
3
4use \Bitrix\Main\Localization\Loc;
5use \Bitrix\Main\Entity;
6
7Loc::loadMessages(__FILE__);
8
25class TemplateTable extends Entity\DataManager
26{
31 public static function getTableName()
32 {
33 return 'b_landing_template';
34 }
35
40 public static function getMap()
41 {
42 return array(
43 'ID' => new Entity\IntegerField('ID', array(
44 'primary' => true,
45 'autocomplete' => true,
46 'title' => 'ID'
47 )),
48 'ACTIVE' => new Entity\StringField('ACTIVE', array(
49 'title' => Loc::getMessage('LANDING_TABLE_FIELD_ACTIVE'),
50 'default_value' => 'Y'
51 )),
52 'TITLE' => new Entity\StringField('TITLE', array(
53 'title' => Loc::getMessage('LANDING_TABLE_FIELD_TITLE'),
54 'required' => true,
55 'fetch_data_modification' => function()
56 {
57 return array(
58 function ($value)
59 {
60 if (mb_substr($value, 0, 1) == '#')
61 {
62 $langCode = mb_substr(mb_substr($value, 1), 0, -1);
63 $mess = Loc::getMessage('LANDING_TABLE_TPL_' . $langCode);
64 if ($mess)
65 {
66 return $mess;
67 }
68 else
69 {
70 return $value;
71 }
72 }
73 else
74 {
75 return $value;
76 }
77 }
78 );
79 }
80 )),
81 'SORT' => new Entity\IntegerField('SORT', array(
82 'title' => Loc::getMessage('LANDING_TABLE_FIELD_SORT')
83 )),
84 'XML_ID' => new Entity\StringField('XML_ID', array(
85 'title' => Loc::getMessage('LANDING_TABLE_FIELD_XML_ID')
86 )),
87 'CONTENT' => new Entity\StringField('CONTENT', array(
88 'title' => Loc::getMessage('LANDING_TABLE_FIELD_CONTENT')
89 )),
90 'AREA_COUNT' => new Entity\IntegerField('AREA_COUNT', array(
91 'title' => Loc::getMessage('LANDING_TABLE_FIELD_AREA_COUNT'),
92 'required' => true
93 )),
94 'CREATED_BY_ID' => new Entity\IntegerField('CREATED_BY_ID', array(
95 'title' => Loc::getMessage('LANDING_TABLE_FIELD_CREATED_BY_ID'),
96 'required' => true
97 )),
98 'CREATED_BY' => new Entity\ReferenceField(
99 'CREATED_BY',
100 'Bitrix\Main\UserTable',
101 array('=this.CREATED_BY_ID' => 'ref.ID')
102 ),
103 'MODIFIED_BY_ID' => new Entity\IntegerField('MODIFIED_BY_ID', array(
104 'title' => Loc::getMessage('LANDING_TABLE_FIELD_MODIFIED_BY_ID'),
105 'required' => true
106 )),
107 'MODIFIED_BY' => new Entity\ReferenceField(
108 'MODIFIED_BY',
109 'Bitrix\Main\UserTable',
110 array('=this.MODIFIED_BY_ID' => 'ref.ID')
111 ),
112 'DATE_CREATE' => new Entity\DatetimeField('DATE_CREATE', array(
113 'title' => Loc::getMessage('LANDING_TABLE_FIELD_DATE_CREATE'),
114 'required' => true
115 )),
116 'DATE_MODIFY' => new Entity\DatetimeField('DATE_MODIFY', array(
117 'title' => Loc::getMessage('LANDING_TABLE_FIELD_DATE_MODIFY'),
118 'required' => true
119 ))
120 );
121 }
122}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29