File tree Expand file tree Collapse file tree 3 files changed +134
-0
lines changed
custom-cms-entry-form-layout/5.41.x/extensions/models Expand file tree Collapse file tree 3 files changed +134
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " models" ,
3
+ "main" : " src/index.ts" ,
4
+ "keywords" : [
5
+ " webiny-extension" ,
6
+ " webiny-extension-type:api"
7
+ ],
8
+ "version" : " 1.0.0" ,
9
+ "dependencies" : {
10
+ "@webiny/api-headless-cms" : " 5.41.4-beta.5"
11
+ }
12
+ }
Original file line number Diff line number Diff line change
1
+ import {
2
+ createCmsGroupPlugin ,
3
+ createCmsModelPlugin ,
4
+ createModelField
5
+ } from "@webiny/api-headless-cms" ;
6
+
7
+ export const createExtension = ( ) => {
8
+ return [
9
+ // Defines a new "E-Commerce" content models group.
10
+ createCmsGroupPlugin ( {
11
+ id : "pizzeria" ,
12
+ name : "Pizzeria" ,
13
+ description : "Pizzeria-related content models." ,
14
+ slug : "pizzeria" ,
15
+ icon : "fas/pizza-slice"
16
+ } ) ,
17
+
18
+ // Defines a new "Product" content model.
19
+ createCmsModelPlugin ( {
20
+ name : "Pizza" ,
21
+ modelId : "pizza" ,
22
+ description : "Pizza related content." ,
23
+ group : {
24
+ id : "pizzeria" ,
25
+ name : "Pizzeria"
26
+ } ,
27
+ fields : [
28
+ createModelField ( {
29
+ id : "gaj2w2eb" ,
30
+ fieldId : "name" ,
31
+ storageId : "text@gaj2w2eb" ,
32
+ type : "text" ,
33
+ label : "Name" ,
34
+ renderer : {
35
+ name : "text-input" ,
36
+ settings : { }
37
+ } ,
38
+ validation : [
39
+ {
40
+ name : "required" ,
41
+ settings : { } ,
42
+ message : "Title is a required field."
43
+ }
44
+ ]
45
+ } ) ,
46
+ createModelField ( {
47
+ id : "wz3runy7" ,
48
+ fieldId : "price" ,
49
+ storageId : "number@wz3runy7" ,
50
+ type : "number" ,
51
+ label : "Price" ,
52
+ renderer : {
53
+ name : "number-input" ,
54
+ settings : { }
55
+ }
56
+ } ) ,
57
+ createModelField ( {
58
+ id : "s7wqd2g0" ,
59
+ fieldId : "numberOfIngredients" ,
60
+ storageId : "number@s7wqd2g0" ,
61
+ type : "number" ,
62
+ label : "Number of ingredients" ,
63
+ renderer : {
64
+ name : "number-input" ,
65
+ settings : { }
66
+ }
67
+ } ) ,
68
+ createModelField ( {
69
+ id : "pcofsq5m" ,
70
+ fieldId : "glutenFree" ,
71
+ storageId : "boolean@pcofsq5m" ,
72
+ type : "boolean" ,
73
+ label : "Gluten-free" ,
74
+ renderer : {
75
+ name : "boolean-input" ,
76
+ settings : { }
77
+ } ,
78
+ settings : {
79
+ defaultValue : false
80
+ }
81
+ } ) ,
82
+ createModelField ( {
83
+ id : "02hbjdy6" ,
84
+ fieldId : "recipe" ,
85
+ storageId : "long-text@02hbjdy6" ,
86
+ type : "long-text" ,
87
+ label : "Recipe" ,
88
+ renderer : {
89
+ name : "long-text-text-area" ,
90
+ settings : { }
91
+ }
92
+ } ) ,
93
+ createModelField ( {
94
+ id : "occavfqi" ,
95
+ fieldId : "history" ,
96
+ storageId : "long-text@occavfqi" ,
97
+ type : "long-text" ,
98
+ label : "History" ,
99
+ renderer : {
100
+ name : "long-text-text-area" ,
101
+ settings : { }
102
+ }
103
+ } )
104
+ ] ,
105
+ icon : "fas/pizza-slice" ,
106
+ descriptionFieldId : "recipe" ,
107
+ layout : [
108
+ [ "gaj2w2eb" ] ,
109
+ [ "wz3runy7" ] ,
110
+ [ "s7wqd2g0" ] ,
111
+ [ "pcofsq5m" ] ,
112
+ [ "02hbjdy6" ] ,
113
+ [ "occavfqi" ]
114
+ ] ,
115
+ titleFieldId : "name"
116
+ } )
117
+ ] ;
118
+ } ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "extends" : " ../../tsconfig.json" ,
3
+ "include" : [" src" ]
4
+ }
You can’t perform that action at this time.
0 commit comments