Loading...

Making changes to the content model

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

To add new fields to content types:

  1. Sign in to Drupal Starter Kits.
  2. In the Drupal Starter Kits administrative interface, click Manage > Structure > Content Types > Select Content Type > Manage Fields.
  3. Click Add field.
  4. In Add a new field, select field type from the dropdown menu.
  5. In Label, enter a name.
  6. Click Save and continue.
  7. Select the number of items you want to allow. 

    Based on you requirements, select Limited or Unlimited.

  8. Add help text

    Based on your requirements, confirm whether the default value is required.

  9. Click on Save settings.
  10. Verify the changes on your site.

    These steps adhere to Drupal best practices for adding new fields to content types.

Capturing configuration

To capture configurations from the applications administrative user interface:

  1. Sign in to Drupal Starter Kits.
  2. Enable the Configuration Manager module.
  3. In the Drupal Starter Kits administrative interface, click Manage > Configuration > Development > Configuration Synchronization > Export.
  4. Click Single item.
  5. In Configuration Type, select Field from the drop-down menu.
  6. In the Configuration name drop-down menu, select the field you added to the content type.
  7. In your config/sync directory, create a new file with the suggested filename on the Config export page.
  8. Copy and paste the text from Here is your configuration.
  9. In Configuration Type, select Field storage from the drop-down menu.
  10. In your config/sync directory:
    1. Create a new file with the suggested filename on the config export page.
    2. 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 that you make changes to the fields that are included with Drupal Starter Kits. Instead, Acquia recommends that you create new fields based on your requirements. For information about adding new fields, see Adding a new field.

Removing an existing field

To remove an existing field:

  1. Sign in to Drupal Starter Kits.
  2. In the Drupal Starter Kits administrative interface, click Manage > Structure > Content Types > Select Content Type > Manage Fields.
  3. In the Operation of the field you wish to remove, click on the drop-down arrow.
  4. Click Delete.

    The system redirects you to the confirmation page.

  5. Click Delete.
  6. Verify the changes on your site.

    These steps adhere to Drupal best practices for removing existing fields.

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 any changes occur in the deleted field in subsequent module updates, hook_update_N() returns an error that the configuration does not exist.

Updates to unmodified fields

If Drupal Starter Kits update a field type on a content type and you have not made any changes to that field, the update from Drupal Starter Kits 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.

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation