1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* UserAdds info |
5
|
|
|
* |
6
|
|
|
* @author Alexey Krupskiy <[email protected]> |
7
|
|
|
* @link http://inji.ru/ |
8
|
|
|
* @copyright 2015 Alexey Krupskiy |
9
|
|
|
* @license https://github.com/injitools/cms-Inji/blob/master/LICENSE |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Ecommerce\UserAdds; |
13
|
|
|
/** |
14
|
|
|
* @property int $id |
15
|
|
|
* @property string $name |
16
|
|
|
* @property string $type |
17
|
|
|
* @property string $code |
18
|
|
|
* @property string $options |
19
|
|
|
* @property string $userfield |
20
|
|
|
* @property string $placeholder |
21
|
|
|
* @property string $help_text |
22
|
|
|
* @property bool $required |
23
|
|
|
* @property bool $save |
24
|
|
|
* @property number $weight |
25
|
|
|
* @property string $date_create |
26
|
|
|
* |
27
|
|
|
* @property-read \Ecommerce\UserAdds\Field\Item[] $fieldItems |
28
|
|
|
* |
29
|
|
|
* @method \Ecommerce\UserAdds\Field\Item[] fieldItems($options) |
30
|
|
|
*/ |
31
|
|
|
class Field extends \Model { |
32
|
|
|
|
33
|
|
|
public static $objectName = 'Поле информации при заказе'; |
34
|
|
|
public static $cols = [ |
35
|
|
|
//Основные параметры |
36
|
|
|
'name' => ['type' => 'text'], |
37
|
|
|
'type' => ['type' => 'select', 'source' => 'array', 'empty' => false, 'sourceArray' => [ |
38
|
|
|
'text' => 'Текстовое поле', |
39
|
|
|
'textarea' => 'Многострочный текст', |
40
|
|
|
'select' => 'Выпадающий список', |
41
|
|
|
]], |
42
|
|
|
'code' => ['type' => 'text'], |
43
|
|
|
'options' => ['type' => 'textarea'], |
44
|
|
|
'userfield' => ['type' => 'text'], |
45
|
|
|
'placeholder' => ['type' => 'text'], |
46
|
|
|
'help_text' => ['type' => 'text'], |
47
|
|
|
'required' => ['type' => 'bool'], |
48
|
|
|
'save' => ['type' => 'bool'], |
49
|
|
|
//Системные |
50
|
|
|
'fieldItem' => ['type' => 'dataManager', 'relation' => 'fieldItems'], |
51
|
|
|
'weight' => ['type' => 'number'], |
52
|
|
|
'date_create' => ['type' => 'dateTime'], |
53
|
|
|
]; |
54
|
|
|
public static $labels = [ |
55
|
|
|
'name' => 'Название', |
56
|
|
|
'type' => 'Тип', |
57
|
|
|
'required' => 'Обязательно', |
58
|
|
|
'placeholder' => 'Плейсхолдер', |
59
|
|
|
'userfield' => 'Связь с полем профиля', |
60
|
|
|
'help_text' => 'Подсказка для заполнения', |
61
|
|
|
'save' => 'Сохраняется', |
62
|
|
|
'options' => 'Системные настройки поля', |
63
|
|
|
]; |
64
|
|
|
public static $dataManagers = [ |
65
|
|
|
'manager' => [ |
66
|
|
|
'cols' => [ |
67
|
|
|
'name', 'type', 'userfield', 'placeholder', 'required', 'save' |
68
|
|
|
], |
69
|
|
|
'sortMode' => true |
70
|
|
|
] |
71
|
|
|
]; |
72
|
|
|
public static $forms = [ |
73
|
|
|
'manager' => [ |
74
|
|
|
'map' => [ |
75
|
|
|
['name', 'type'], |
76
|
|
|
['required', 'save'], |
77
|
|
|
['userfield', 'placeholder'], |
78
|
|
|
['help_text'], |
79
|
|
|
['options'] |
80
|
|
|
] |
81
|
|
|
] |
82
|
|
|
]; |
83
|
|
|
|
84
|
|
|
public static function relations() { |
85
|
|
|
return [ |
86
|
|
|
'fieldItems' => [ |
87
|
|
|
'model' => 'Ecommerce\UserAdds\Field\Item', |
88
|
|
|
'col' => 'useradds_field_id', |
89
|
|
|
'type' => 'many' |
90
|
|
|
], |
91
|
|
|
]; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|