Last active
August 1, 2019 15:06
-
-
Save Jimmydalecleveland/79e9bfa67ce663b5986ab10328894f6d to your computer and use it in GitHub Desktop.
Contentful Migration of button to CTA.
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
// 2) Runs second | |
module.exports = migration => { | |
const cta = migration | |
.createContentType('cta') | |
.name('CTA') | |
.description('A call to action') | |
.displayField('identifier') | |
cta | |
.createField('identifier') | |
.name('Identifier') | |
.type('Symbol') | |
.validations([{ unique: true }]) | |
.required(true) | |
cta | |
.createField('type') | |
.name('Type') | |
.type('Symbol') | |
.validations([{ in: ['Link', 'Phone', 'Zip', 'Newsletter'] }]) | |
.required(true) | |
cta | |
.createField('buttonText') | |
.name('Button Text') | |
.type('Symbol') | |
.required(true) | |
cta | |
.createField('labelText') | |
.name('Label Text') | |
.type('Symbol') | |
cta | |
.createField('placeholderText') | |
.name('Placeholder Text') | |
.type('Symbol') | |
cta | |
.createField('destinationURL') | |
.name('Destination URL') | |
.type('Symbol') | |
.validations([ | |
{ | |
message: 'Must be a valid URL format', | |
regexp: { | |
pattern: `((http(s)?:\\/\\/.)?(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*))|(^\\/[-a-zA-Z0-9@:%._\\+~#=]{0,256})`, | |
}, | |
}, | |
]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment