Site Building

Add a Media Field to a Content Type in Drupal for Drupal 8, 9, and 10

The most common way to use Drupal's Media items is to add fields to content types, allowing the Media entities to be associated with one or more pieces of content. For example, adding a cover image to an article, or embedding a set of YouTube videos into a tutorial. This is accomplished by adding a Media field to the content type in question.

In this tutorial we'll:

  • Explain what the different Media field-specific configuration options do
  • Add a Media field to the existing Article content type
  • Explain what the different field-specific configuration options do
  • Confirm that it worked by verifying that the form for adding an article has the new field

By the end of this tutorial you'll know how to add a Media field to any content type, or any other fieldable entity, in order to allow Media items to be associated with the content.