-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
custom-cms-entry-form-layout/5.41.x/extensions/models/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "models", | ||
"main": "src/index.ts", | ||
"keywords": [ | ||
"webiny-extension", | ||
"webiny-extension-type:api" | ||
], | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"@webiny/api-headless-cms": "5.41.4-beta.5" | ||
} | ||
} |
118 changes: 118 additions & 0 deletions
118
custom-cms-entry-form-layout/5.41.x/extensions/models/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import { | ||
createCmsGroupPlugin, | ||
createCmsModelPlugin, | ||
createModelField | ||
} from "@webiny/api-headless-cms"; | ||
|
||
export const createExtension = () => { | ||
return [ | ||
// Defines a new "E-Commerce" content models group. | ||
createCmsGroupPlugin({ | ||
id: "pizzeria", | ||
name: "Pizzeria", | ||
description: "Pizzeria-related content models.", | ||
slug: "pizzeria", | ||
icon: "fas/pizza-slice" | ||
}), | ||
|
||
// Defines a new "Product" content model. | ||
createCmsModelPlugin({ | ||
name: "Pizza", | ||
modelId: "pizza", | ||
description: "Pizza related content.", | ||
group: { | ||
id: "pizzeria", | ||
name: "Pizzeria" | ||
}, | ||
fields: [ | ||
createModelField({ | ||
id: "gaj2w2eb", | ||
fieldId: "name", | ||
storageId: "text@gaj2w2eb", | ||
type: "text", | ||
label: "Name", | ||
renderer: { | ||
name: "text-input", | ||
settings: {} | ||
}, | ||
validation: [ | ||
{ | ||
name: "required", | ||
settings: {}, | ||
message: "Title is a required field." | ||
} | ||
] | ||
}), | ||
createModelField({ | ||
id: "wz3runy7", | ||
fieldId: "price", | ||
storageId: "number@wz3runy7", | ||
type: "number", | ||
label: "Price", | ||
renderer: { | ||
name: "number-input", | ||
settings: {} | ||
} | ||
}), | ||
createModelField({ | ||
id: "s7wqd2g0", | ||
fieldId: "numberOfIngredients", | ||
storageId: "number@s7wqd2g0", | ||
type: "number", | ||
label: "Number of ingredients", | ||
renderer: { | ||
name: "number-input", | ||
settings: {} | ||
} | ||
}), | ||
createModelField({ | ||
id: "pcofsq5m", | ||
fieldId: "glutenFree", | ||
storageId: "boolean@pcofsq5m", | ||
type: "boolean", | ||
label: "Gluten-free", | ||
renderer: { | ||
name: "boolean-input", | ||
settings: {} | ||
}, | ||
settings: { | ||
defaultValue: false | ||
} | ||
}), | ||
createModelField({ | ||
id: "02hbjdy6", | ||
fieldId: "recipe", | ||
storageId: "long-text@02hbjdy6", | ||
type: "long-text", | ||
label: "Recipe", | ||
renderer: { | ||
name: "long-text-text-area", | ||
settings: {} | ||
} | ||
}), | ||
createModelField({ | ||
id: "occavfqi", | ||
fieldId: "history", | ||
storageId: "long-text@occavfqi", | ||
type: "long-text", | ||
label: "History", | ||
renderer: { | ||
name: "long-text-text-area", | ||
settings: {} | ||
} | ||
}) | ||
], | ||
icon: "fas/pizza-slice", | ||
descriptionFieldId: "recipe", | ||
layout: [ | ||
["gaj2w2eb"], | ||
["wz3runy7"], | ||
["s7wqd2g0"], | ||
["pcofsq5m"], | ||
["02hbjdy6"], | ||
["occavfqi"] | ||
], | ||
titleFieldId: "name" | ||
}) | ||
]; | ||
}; |
4 changes: 4 additions & 0 deletions
4
custom-cms-entry-form-layout/5.41.x/extensions/models/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["src"] | ||
} |