Content Type Fields

Next, you will want to add some fields to your new content type. In its empty state, it is nothing but a title. Your task is to determine what information you want to collect and how to best represent it.

To add a field, navigate to administer > content> content types > list (admin/node/types). From this page, you can track all of your flexinode content types. The list of links on the right (add checkbox, add file, add image, and so on) correspond to the field type files that you included in the modules/flexinode folder during installation. Clicking one of these links will add a field of this type to the data model of your flexinode.

For the Basketball Team example, let's start with add textfield to add a field for the name of the team's contact person (the default Title field can be used for the team's name). The screen for adding a text field has seven fields:

• Field Label is the only required field on this form. The value entered here becomes the label on the text field you are adding to the Basketball Team type.

• The text you enter in the Description field will appear directly underneath the field and serves as a help text in case it isn't clear from the field label what this field is for.

• Entering a value in the Default Value field will prefill the field.

• If the field is to be required, so that it will be impossible to submit the form without filling in a value for it, check the Required Field check box.

• The teaser of a node is the summary version that is shown in lists. If this field is to appear as part of the teaser, check the Show in Teaser check box.

• Each flexinode type has a tabular view where all nodes of that type can be browsed, complete with sortable columns. If this field is to be one of the fields in that table, check the Show in Table check box.

The Weight value orders the field among all other fields on the form.

Figure 4-11 shows an example of the edit field form for the text field and what it produces on the Baseball Team creation form.

Home » administer » content » content types edit field

Field label:*_

[Contact person |


[The adult responsible for the team, usally the coach |

A brief description of the fields to be displayed on the content submission form. Default value:

a Required field

Whether the user must fill in the field when creating content.

0 Show in teaser

Whether this field should be shown as part of the teaser.

0 Show in table

Whether this field should be shown as part of this content type's tabular view,


Optional. On the content editing form^ the heavier fields will sink and the lighter fields will be positioned nearer the top.

Submit basketball team

Make sure your team photo is smaller than 1MB in size before uploading. Title:*_

Contact person^_

The adult responsible for the team^ usally the coach

Figure 4-11. Adding a text field to the form

These seven fields appear on all field type forms. A text field is the simplest field type and has only the standard seven configuration options. Others, such as drop-down menu and table, have extra configuration options in addition to the seven standard ones.

Adding a drop-down menu to the form, for determining which league a team plays in, is similar to adding the text field. Start by clicking add dropdown menu from the admin/node/ types screen. In addition to the seven standard fields, the form for adding a drop-down menu has a group called Options. The values you enter here will become the various options in the content-creation form later. Clicking the More button provides additional fields in case you need more options.

In the same way, you will be able to add the other fields needed to complete the Basketball Team form. The example in Figure 4-12 uses various core and contributed field types, including the following:

An e-mail address field for Contact email A table field for Players A text field for Motto An image field for Team photo Color pickers for the Team color fields

Figure 4-12. A finished basketball team node

Was this article helpful?

0 0

Post a comment