The Field module (GovCMS core) provides the configuration for fields and field attachments; the field types and input widgets themselves are provided by additional modules. Some of the modules are required, and the optional modules can be enabled from the Modules administration page (Administer → Modules).
GovCMS core includes the following field type modules: Text (required), Number, List, Taxonomy, Image, and File. Additional fields and widgets may be provided by contributed modules.
The Field module allows custom data fields to be attached to GovCMS entities (content nodes, users, taxonomy vocabularies, etc.) and takes care of storing, loading, editing, and rendering field data. Most users will not interact with the Field module directly, but will instead use the Field UI module user interface. Module developers can use the Field API to make new entities "fieldable" and allow fields to be attached to their entities.
Go to Structure → Content types → Job posting → Manage fields
Click edit on the body field (this will only change the way the field appears in the Job posting content type, and not others)
Change the Label to “Job description”
Deselect Summary input
Click Save settings. Your field listing should show the new label.
For our Government Jobs Portal website, we want to let site visitors filter job offers by full time/part time. In this exercise, we’ll add this value in.
Add a field Let’s start by adding our first field – Terms of employment
Under Add a new field, scroll down and under Text, select List (text)
Enter “Terms of employment” for Label
For the Machine name, click edit and enter the machine name: jobterms
Click Save and continue
Click Save and continue and you’ll go back to the Field settings page for the Terms of employment field.
Review the Field naming conventions section below, before moving to the Field settings.
When adding a new field, GovCMS automatically suggests a field name. You can edit the field name when you’re adding it but cannot change it later on. When naming the field you should think carefully about a logical name, especially if you’ll be using the field in other content types.
The field name can only contain lowercase letters, numbers 0-9, and the underscore character. It’s a good idea to set up a naming convention early on.
To view the fields you’ve created, go to Reports Field list
Configure field settings
Next we’ll set up the values (items) for our dropdown list. Add the following options to the Allowed Values list text area:
1|Permanent 2|Temporary 3|Part-time 4|Full-time
You must include the numbers before each entry because they provide a numerical key for each option, which means you can change the names of the items without losing content.
Select “Limited” and “1” in the Allowed number of values.
Click Save field settings.
Configure default settings
Now you’ll see the Edit tab, with the field’s default settings. Follow these settings:
Select Required Field
Help text: “Please select terms of employment” (to be displayed when creating or editing Job Posting content)
Default value for Terms of employment: leave this as - None -
Click Save settings. You’ll then be returned to the Manage fields page
Manage Form display The Manage Form display tab allows you to control fields that will be available in the content creation form, along with widgets. This page is used to make adjustments to the widgets used in content types. Navigate to the Manage Form display page and review the available fields. Locate the “Terms of employment” field you created and review what widget selection is available.
Review your content type
Once you’ve saved your last field, you’ll be taken back to the Job Posting Manage fields page. All the fields you added to your content type will be visible here.
Finally, you should test the content type by adding content to it. Go to Content → Add content and choose the “Job posting” option. Check the form and create a test job posting for a full-time job as a Drupal developer. Save the new job posting and note the URL path for the new content.
Go to Reports → Field list to see a list of fields added to your site
Delete any unused fields on your site
Remember, using common fields across multiple content types allows you to edit some global settings and values in one place.