forked from valantic-at/ProcessManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
118 lines (95 loc) · 3.64 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
pimcore.registerNS("pimcore.plugin.processmanager.executor.callback.example");
pimcore.plugin.processmanager.executor.callback.example = Class.create(pimcore.plugin.processmanager.executor.callback.abstractCallback, {
//a custom name
name: "example",
// remove this param or set it to "window" if you want that the callback is opened in a modal window instead of a tab
// callbackWindowType: 'tab',
//change the label width
//labelWidth : 300,
getFormItems: function () {
var items = [];
//general properties - supported by all field types
var config = {
mandatory: false, //bool - defines if the field is required
tooltip: t("plugin_pm_myTooltip") //add a tooltip icon for explanations
}
//Input field
items.push(this.getTextField('myTextField', config));
//Textarea field
items.push(this.getTextArea('myTextArea', config));
//Number field
items.push(this.getNumberField('myNumber', config));
//Date field
items.push(this.getDateField('myDate', config));
//Select a pimcore role
items.push(this.getRoleSelection('myRole', config));
//Select a pimcore locale
items.push(this.getLocaleSelection('myLocale', config));
//Checkbox
items.push(this.getCheckbox('myCheckbox', config));
//Select field
var selectConfig = config;
selectConfig.store = [
['key1', t('plugin_pm_example_select_1')],
['key2', t('plugin_pm_example_select_2')]
];
items.push(this.getSelectField('mySelectField', selectConfig));
//Href field (a itemSelectorConfig can also be passed to limit the selection -> @see items.push(this.getItemSelector('myItems',itemSelectorConfig)); below
items.push(this.getHref('myHref', config));
//item Selector
var itemSelectorConfig = config;
/*
//Add a custom button to the item selector and restrict the selections to objects of the class "Product"
var materialAddButton = {
xtype: "button",
iconCls: "pimcore_icon_add",
handler: function () {
alert('Open Custom window...');
}.bind(this)
};
//values for type: "object","document","asset"
var itemSelectorConfig = {
itemSelectorConfig: {type: ["object"], specific: {classes: ['Product']}},
buttons : [materialAddButton],
mandatory : true
};
*/
items.push(this.getItemSelector('myItems', itemSelectorConfig));
var propertySelectorConfig = config;
var propertySelectorConfig = {
storeUrl: '/admin/elementsprocessmanager/index/property-list',
mandatory: false
/*,
//column config - optional - default to "name" column for display
columns : [
{
text: 'Id',
sortable: true,
dataIndex: "id"
},
{
text: t("plugin_pm_property_selector_propertyname"),
sortable: true,
dataIndex: "name",
flex: 1
}
]*/
};
/*
* The /admin/elementsprocessmanager/index/property-list call returns a array like this
{
"success": true,
"data": [
{
"id": 1,
"name": "Display text - myProperties - 1"
},
{
"id": 2,
"name": "Display text - myProperties - 2"
}
}*/
items.push(this.getPropertySelector('myProperties', propertySelectorConfig));
return items;
}
});