Two weeks ago I wrote blog posts on Getting Started, Adding a Contact Form, and Creating a New Page Type for Statamic. As part of creating a new Page Type we also created new fields for the Page Type. One of the questions I had afterwards was how to reorder the fields because the Page Content Field was appearing at the bottom of the page. I wanted it to appear in place where I had it in the code. Just as a refresher here is that code:
title: Contact Page fields: _template: display: Template type: templates image: type: file display: Upload an Image destination: assets/img show_thumbnail: true where: display: Where It’s At type: location content: display: Page Content required: false default: type: markitup results-content: display: Results Page Content required: false default: type: markitup email: type: text display: Email Address phone: type: text display: Phone Number twitter: type: text display: Twitter URL facebook: type: text display: Facebook URL dribbble: type: text display: Dribbble URL linkedin: type: text display: LinkedIn URL
Yesterday Matt Steele asked me if I had figured out the field order bit from the last blog post. The resident Community Manager, Gareth Redfern had the following to say:
So basically, the following:
content: display: Page Content required: false default: type: markitup
was throwing us a curve ball. The fix? All I had to do was change the name of the field from content to something other as Statamic processes the Content field and puts it at the bottom of the form. So I made the following change:
instructions: display: Page Content required: false default: type: markitup
and it worked just like I wanted it to. You'll also want to add the following to the end of the contact.yaml file:
content: display: Page Content required: false default: special type: hidden
The content field is required unless specified otherwise so you have to tell Statamic to hide that field since we are not going to use it. So, thanks Gareth!