The Drupal Starter Kits content model is intended to be used as provided or as a starting point. You can update the content model to meet the requirements of your information architecture. This page provides information on what happens if you add, update, or remove fields from the content model.
Note
This page uses content types as an example, but the same applies for media types and taxonomy vocabularies.
Adding a new field
Best Practices
Follow Drupal best practices to add new fields to content types:
- Sign in to Drupal Starter Kits.
- In the Drupal Starter Kits administrative interface, click Manage > Structure > Content Types > Select Content Type > Manage Fields.
- Click Add field.
- In Add a new field, select field type from the dropdown menu.
- In Label, enter a name.
- Click Save and continue.
- Select the number of items you want to allow. You can select Limited or Unlimited based on your requirements.
Add help text
Based on your requirements, confirm whether the default value is required.
- Click on Save settings.
- Verify the changes on your site.
Capturing configuration
You can capture configurations from the applications administrative user interface.
- Sign in to Drupal Starter Kits.
- Enable the Configuration Manager module.
- In the Drupal Starter Kits administrative interface, click Manage > Configuration > Development > Configuration Synchronization > Export.
- Click Single item.
- In Configuration Type, select Field from the drop-down menu.
- In the Configuration name drop-down menu, select the field you added to the content type.
- In your config/sync directory, create a new file with the suggested filename on the Config export page.
- Copy and paste the text from Here is your configuration.
- In Configuration Type, select Field storage from the drop-down menu.
- In your config/sync directory, create a new file with the suggested filename on the config export page, and copy-paste the text from Here is your configuration textarea.
Subsequent updates
Your configurations are kept when a new update is released to Drupal Starter Kits. Drupal only reads and updates configuration once when the module is first installed.
Updating an existing field
Acquia does not recommend making changes to the fields that are included with Drupal Starter Kits. Instead, Acquia recommends creating new fields as per your requirement. For information about adding new fields, see Adding a new field.
Removing an existing field
Best Practices
Follow Drupal best practices for adding new fields to content types:
- Sign in to Drupal Starter Kits.
- In the Drupal Starter Kits administrative interface, click Manage > Structure > Content Types > Select Content Type > Manage Fields.
- In the Operation of the field you wish to remove, click on the drop-down arrow.
Click Delete.
The system redirects you to the confirmation page.
- Click Delete.
- Verify the changes on your site.
Capturing configuration
You must capture the configuration once you make changes for future reference. You can use drush to export configurations such as drush cex
. If it exists, delete the configuration file of the deleted field from the config/sync directory.
Subsequent updates
Your configurations are kept when a new update is released to Drupal Starter Kits. Drupal only reads and updates configuration once when the module is first installed.
Note
If there are updates to the deleted field in subsequent module updates, hook_update_N()
throws an error that the configuration does not exist.
Updates to unmodified fields
If Drupal Starter Kits makes an update to a field type on a content type, and you have not made any changes to that field, the Drupal Starter Kits update is applied when you update Drupal Starter Kits.
For example, there is a provided content type and it has an autocomplete text box field. A future update changes that field to a checkbox. The following are applied:
- If you have not changed the field, the update changes the field from an autocomplete text box field to a checkbox when you update Drupal Starter Kits.
- If you removed the field, the update changes do not recreate that field again. The Drupal Starter Kits update does not impact you.
- If you changed the field, the update changes do not apply to the field because you changed the original field.
The Drupal Starter Kits update only applies if the original field exists with no modifications.