forked from contentful/contentful-migration
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path40-move-field-in-editor-layout.js
More file actions
26 lines (22 loc) · 1.08 KB
/
40-move-field-in-editor-layout.js
File metadata and controls
26 lines (22 loc) · 1.08 KB
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
module.exports = function (migration) {
const myType = migration.createContentType('mytype').name('My type')
myType.createField('fieldA').name('Field A').type('Symbol')
myType.createField('fieldB').name('Field B').type('Symbol')
myType.createField('fieldC').name('Field C').type('Symbol')
myType.createField('fieldD').name('Field D').type('Symbol')
myType.createField('fieldE').name('Field D').type('Symbol')
// an editor layout can be created empty but not saved without adding at least one tab
const editorLayout = myType.createEditorLayout()
editorLayout.createFieldGroup('firsttab', {
name: 'First Tab'
})
editorLayout.createFieldGroup('secondtab', {
name: 'Second Tab'
})
editorLayout.editFieldGroup('secondtab').createFieldGroup('fieldset').name('Field Set')
editorLayout.moveField('fieldA').toTheTopOfFieldGroup('fieldset')
editorLayout.moveField('fieldB').beforeFieldGroup('fieldset')
editorLayout.moveField('fieldC').afterField('fieldA')
editorLayout.moveField('fieldE').beforeField('fieldC')
editorLayout.moveField('fieldE').toTheBottomOfFieldGroup()
}