How Can We Help?
< All Topics
Print

Enhancing Content Types with Basic Fields in Drupal: A How-To Guide

a) How do I add basic fields to content types in Drupal ?

1. First, navigate to Structure in the Manage administrative menu (Admin/Structure/Types) to access Content Types.

2. Then, click on the Manage field in the Vendor Content Type drop-down button, and the Manage Fields page will appear.

3. After that, click on the “Addfield to access the Add Field page, where you can either create a new field for a specific content type or reuse an existing one.

4. Next, fill in the fields shown below. 

Field name Explanation Example value
Add a new field Field type Link
Label The tags are visible on the admin pages Vendor URL

Note: The feature generates machine names automatically based on tag values, and users can override the default name by clicking on Edit.

5. Then, click Save and Continue to display the vendor URL, set the allowed values, and fill in the required fields.

Field name Explanation Example value
Allowed number of values The maximum number of values that can be entered Limited,1

6. After that, click on “Save field settings” to access the Vendor URL settings page, where you can configure this field and fill in the necessary fields.

Field name Explanation Example value
Label Labels visible in content forms Vendor URL
Help text The description is shown below the field (leave blank)
Required field The field’s necessity or non-necessity Unchecked
Allowed link type Types of links that can be entered External links only
Allow link text Whether a link text can be entered Disabled

7. Next, click Save Settings to add the vendor URL to the content type and continue creating the main image field.

8. Then, click on the “Add Field” button to open the Add Fields page and fill in the provided fields.

Field name Explanation Example value
Add a new field Field type Image
Label Tags visible on admin pages Main image

9. After that, click on “Save and Continue” to view the page’s main image and fill in the provided fields.

Field name Explanation Example value
Allowed number of values The maximum number of values that can be entered Limited,1

Note: This option allows you to set a default image when you don’t provide an image when creating a vendor content item.

10. Next, click on “Save field settings” to access the provider’s main image settings page and fill out the provided fields.

Field name Explanation Example value
Label Labels visible in content forms Main image
Help text The description is provided below the field (leave blank)
Required field The field’s necessity or non-necessity Checked
Allowed file extensions Types of images that can be uploaded png, gif, jpg, jpeg
File directory The File Directory value ensures that all images uploaded via the Main Image field are stored in the same directory. vendors
Minimum image resolution Minimum resolution for uploaded images 600 x 600
Maximum upload size Maximum file size for uploaded images 5MB
Enabled Alt field Whether an alternative text can be entered Checked
Alt field required Whether an alternative text is required Checked

11. After that, click on Save Settings to add the main image to the content type.

12. Use similar steps to add the main image field to the recipe content type. Start by navigating to the Manage Fields page for the Recipe content type in step 1. Then skip to step 7 and follow the remaining steps, but reuse the existing main image field created for the vendor content type instead of creating a new field. In subsequent steps, some configuration screens will be unavailable due to field reuse.

13. Finally, create two vendor content items, “Happy Farm” and “Sweet Honey,” ensuring they include images and URLs.

Table of Contents