In a previous article we explained the syntax used to write Drupal migrations. When migrating into content entities, these define several properties that can be included in the `process` section to populate their values. For example, when importing nodes you can specify the title, publication status, creation date, etc. In the case of users, you can set the username, password, timezone, etc. Finding out which properties are available for an entity might require some Drupal development knowledge. To make the process easier, in today’s article we are presenting a reference of properties available in content entities provided by Drupal core and some contributed modules.
For each entity we will present: the module that provides it, the class that defines it, and the available properties. For each property we will list its name, field type, a description, and a note if the field allows unlimited values (i.e. it has an unlimited cardinality). The list of properties available for a content entity depend on many factors. For example, if the entity is revisionable (e.g. `revision_default`), translatable (e.g. `langcode`), or both (e.g. `revision_translation_affected`). The modules that are enabled on the site can also affect the available properties. For instance, if the “Workspaces” module is installed, it will add a `workspace` property to many content entities. This reference assumes that Drupal was installed using the `standard` installation profile and all modules that provide content entities are enabled.
It is worth noting that entity properties are divided in two categories: base field definitions and field storage configurations. Base field configurations will always be available for the entity. On the other hand, the presence of field storage configurations will depend on various factors. For one, they can only be added to fieldable entities. Attaching the fields to the entity can be done manually by the user, by a module, or by an installation profile. Again, this reference assumes that Drupal was installed using the `standard` installation profile. Among other things, it adds a `user_picture` image field to the `user` entity and `body`, `comment`, `field_image`, and `field_tags` fields to the `node` entity. For entities that can have multiple bundles, not all properties provided by the field storage configurations will be available in all bundles. For example, with the `standard` installation profile all content types will have a `body` field associated with it, but only the `article` content type has the `field_image`, and `field_tags` fields. If subfields are available for the field type, you can migrate into them.
Content (Node) entity
Module: Node (Drupal Core)
Class: Drupal\node\Entity\Node
Related article: Writing your first Drupal migration
List of base field definitions:
- nid: (integer) The node ID.
- uuid: (uuid) The node UUID.
- vid: (integer) Revision ID.
- langcode: (language) Language code (e.g. `en`).
- type: (entity_reference to node_type) Content type machine name.
- revision_timestamp: (created) The time that the current revision was created.
- revision_uid: (entity_reference to user) The user ID of the author of the current revision.
- revision_log: (string_long) Briefly describe the changes you have made.
- status: (boolean) Node published when set to TRUE.
- uid: (entity_reference to user) The user ID of the content author.
- title: (string) Title.
- created: (created) The time that the node was created.
- changed: (changed) The time that the node was last edited.
- promote: (boolean) Node promoted to front page when set to TRUE.
- sticky: (boolean) Node sticky at top of lists when set to TRUE.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- revision_translation_affected: (boolean) Indicates if the last edit of a translation belongs to current revision.
- workspace: (entity_reference to workspace) Indicates the workspace that this revision belongs to.
List of field storage configurations:
- body: text_with_summary field.
- comment: comment field.
- field_image: image field.
- field_tags: entity_reference field.
User entity
Module: User (Drupal Core)
Class: Drupal\user\Entity\User
Related articles: Migrating users into Drupal – Part 1 and Migrating users into Drupal – Part 2
List of base field definitions:
- uid: (integer) The user ID.
- uuid: (uuid) The user UUID.
- langcode: (language) The user language code.
- preferred_langcode: (language) The user’s preferred language code for receiving emails and viewing the site.
- preferred_admin_langcode: (language) The user’s preferred language code for viewing administration pages.
- name: (string) The name of this user.
- pass: (password) The password of this user (hashed).
- mail: (email) The email of this user.
- timezone: (string) The timezone of this user.
- status: (boolean) Whether the user is active or blocked.
- created: (created) The time that the user was created.
- changed: (changed) The time that the user was last edited.
- access: (timestamp) The time that the user last accessed the site.
- login: (timestamp) The time that the user last logged in.
- init: (email) The email address used for initial account creation.
- roles: (entity_reference to user_role) The roles the user has. Allows unlimited values.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
List of field storage configurations:
- user_picture: image field.
Taxonomy term entity
Module: Taxonomy (Drupal Core)
Class: Drupal\taxonomy\Entity\Term
Related article: Migrating taxonomy terms and multivalue fields into Drupal
List of base field definitions:
- tid: (integer) The term ID.
- uuid: (uuid) The term UUID.
- revision_id: (integer) Revision ID.
- langcode: (language) The term language code.
- vid: (entity_reference to taxonomy_vocabulary) The vocabulary to which the term is assigned.
- revision_created: (created) The time that the current revision was created.
- revision_user: (entity_reference to user) The user ID of the author of the current revision.
- revision_log_message: (string_long) Briefly describe the changes you have made.
- status: (boolean) Published.
- name: (string) Name.
- description: (text_long) Description.
- weight: (integer) The weight of this term in relation to other terms.
- parent: (entity_reference to taxonomy_term) The parents of this term. Allows unlimited values.
- changed: (changed) The time that the term was last edited.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- revision_translation_affected: (boolean) Indicates if the last edit of a translation belongs to current revision.
- workspace: (entity_reference to workspace) Indicates the workspace that this revision belongs to.
File entity
Module: File (Drupal Core)
Class: Drupal\file\Entity\File
Related articles: Migrating files and images into Drupal, Migrating images using the image_import plugin, and Migrating images using the image_import plugin
List of base field definitions:
- fid: (integer) The file ID.
- uuid: (uuid) The file UUID.
- langcode: (language) The file language code.
- uid: (entity_reference to user) The user ID of the file.
- filename: (string) Name of the file with no path components.
- uri: (file_uri) The URI to access the file (either local or remote).
- filemime: (string) The file’s MIME type.
- filesize: (integer) The size of the file in bytes.
- status: (boolean) The status of the file, temporary (FALSE) and permanent (TRUE).
- created: (created) The timestamp that the file was created.
- changed: (changed) The timestamp that the file was last changed.
Module: Media (Drupal Core)
Class: Drupal\media\Entity\Media
List of base field definitions:
- mid: (integer) The media ID.
- uuid: (uuid) The media UUID.
- vid: (integer) Revision ID.
- langcode: (language) Language code (e.g. `en`).
- bundle: (entity_reference to media_type) Media type.
- revision_created: (created) The time that the current revision was created.
- revision_user: (entity_reference to user) The user ID of the author of the current revision.
- revision_log_message: (string_long) Briefly describe the changes you have made.
- status: (boolean) Published.
- uid: (entity_reference to user) The user ID of the author.
- name: (string) Name.
- thumbnail: (image) The thumbnail of the media item.
- created: (created) The time the media item was created.
- changed: (changed) The time the media item was last edited.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- revision_translation_affected: (boolean) Indicates if the last edit of a translation belongs to current revision.
- workspace: (entity_reference to workspace) Indicates the workspace that this revision belongs to.
List of field storage configurations:
- field_media_audio_file: file field.
- field_media_document: file field.
- field_media_image: image field.
- field_media_oembed_video: string field.
- field_media_video_file: file field.
Module: Comment (Drupal Core)
Class: Drupal\comment\Entity\Comment
List of base field definitions:
- cid: (integer) The comment ID.
- uuid: (uuid) The comment UUID.
- langcode: (language) The comment language code.
- comment_type: (entity_reference to comment_type) The comment type.
- status: (boolean) Published.
- uid: (entity_reference to user) The user ID of the comment author.
- pid: (entity_reference to comment) The parent comment ID if this is a reply to a comment.
- entity_id: (entity_reference to node) The ID of the entity of which this comment is a reply.
- subject: (string) Subject.
- name: (string) The comment author’s name.
- mail: (email) The comment author’s email address.
- homepage: (uri) The comment author’s home page address.
- hostname: (string) The comment author’s hostname.
- created: (created) The time that the comment was created.
- changed: (changed) The time that the comment was last edited.
- thread: (string) The alphadecimal representation of the comment’s place in a thread, consisting of a base 36 string prefixed by an integer indicating its length.
- entity_type: (string) The entity type to which this comment is attached.
- field_name: (string) The field name through which this comment was added.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
List of field storage configurations:
- comment_body: text_long field.
Aggregator feed entity
Module: Aggregator (Drupal Core)
Class: Drupal\aggregator\Entity\Feed
List of base field definitions:
- fid: (integer) The ID of the aggregator feed.
- uuid: (uuid) The aggregator feed UUID.
- langcode: (language) The feed language code.
- title: (string) The name of the feed (or the name of the website providing the feed).
- url: (uri) The fully-qualified URL of the feed.
- refresh: (list_integer) The length of time between feed updates. Requires a correctly configured cron maintenance task.
- checked: (timestamp) Last time feed was checked for new items, as Unix timestamp.
- queued: (timestamp) Time when this feed was queued for refresh, 0 if not queued.
- link: (uri) The link of the feed.
- description: (string_long) The parent website’s description that comes from the <description> element in the feed.
- image: (uri) An image representing the feed.
- hash: (string) Calculated hash of the feed data, used for validating cache.
- etag: (string) Entity tag HTTP response header, used for validating cache.
- modified: (timestamp) When the feed was last modified, as a Unix timestamp.
Aggregator feed item entity
Module: Aggregator (Drupal Core)
Class: Drupal\aggregator\Entity\Item
List of base field definitions:
- iid: (integer) The ID of the feed item.
- langcode: (language) The feed item language code.
- fid: (entity_reference to aggregator_feed) The aggregator feed entity associated with this item.
- title: (string) The title of the feed item.
- link: (uri) The link of the feed item.
- author: (string) The author of the feed item.
- description: (string_long) The body of the feed item.
- timestamp: (created) Posted date of the feed item, as a Unix timestamp.
- guid: (string_long) Unique identifier for the feed item.
Custom block entity
Module: Custom Block (Drupal Core)
Class: Drupal\block_content\Entity\BlockContent
List of base field definitions:
- id: (integer) The custom block ID.
- uuid: (uuid) The custom block UUID.
- revision_id: (integer) The revision ID.
- langcode: (language) The custom block language code.
- type: (entity_reference to block_content_type) The block type.
- revision_created: (created) The time that the current revision was created.
- revision_user: (entity_reference to user) The user ID of the author of the current revision.
- revision_log: (string_long) The log entry explaining the changes in this revision.
- status: (boolean) Published.
- info: (string) A brief description of your block.
- changed: (changed) The time that the custom block was last edited.
- reusable: (boolean) A boolean indicating whether this block is reusable.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- revision_translation_affected: (boolean) Indicates if the last edit of a translation belongs to current revision.
- workspace: (entity_reference to workspace) Indicates the workspace that this revision belongs to.
List of field storage configurations:
- body: text_with_summary field.
Module: Contact (Drupal Core)
Class: Drupal\contact\Entity\Message
List of base field definitions:
- uuid: (uuid) The message UUID.
- langcode: (language) The message language code.
- contact_form: (entity_reference to contact_form) The ID of the associated form.
- name: (string) The name of the person that is sending the contact message.
- mail: (email) The email of the person that is sending the contact message.
- subject: (string) Subject.
- message: (string_long) Message.
- copy: (boolean) Whether to send a copy of the message to the sender.
- recipient: (entity_reference to user) The ID of the recipient user for personal contact messages.
Content moderation state entity
Module: Content Moderation (Drupal Core)
Class: Drupal\content_moderation\Entity\ContentModerationState
List of base field definitions:
- id: (integer) ID.
- uuid: (uuid) UUID.
- revision_id: (integer) Revision ID.
- langcode: (language) Language.
- uid: (entity_reference to user) The username of the entity creator.
- workflow: (entity_reference to workflow) The workflow the moderation state is in.
- moderation_state: (string) The moderation state of the referenced content.
- content_entity_type_id: (string) The ID of the content entity type this moderation state is for.
- content_entity_id: (integer) The ID of the content entity this moderation state is for.
- content_entity_revision_id: (integer) The revision ID of the content entity this moderation state is for.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- revision_translation_affected: (boolean) Indicates if the last edit of a translation belongs to current revision.
URL alias entity
Module: Path alias (Drupal Core)
Class: Drupal\path_alias\Entity\PathAlias
List of base field definitions:
- id: (integer) ID.
- uuid: (uuid) UUID.
- revision_id: (integer) Revision ID.
- langcode: (language) Language.
- path: (string) The path that this alias belongs to.
- alias: (string) An alias used with this path.
- status: (boolean) Published.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- workspace: (entity_reference to workspace) Indicates the workspace that this revision belongs to.
Shortcut link entity
Module: Shortcut (Drupal Core)
Class: Drupal\shortcut\Entity\Shortcut
List of base field definitions:
- id: (integer) The ID of the shortcut.
- uuid: (uuid) The UUID of the shortcut.
- langcode: (language) The language code of the shortcut.
- shortcut_set: (entity_reference to shortcut_set) The bundle of the shortcut.
- title: (string) The name of the shortcut.
- weight: (integer) Weight among shortcuts in the same shortcut set.
- link: (link) The location this shortcut points to.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
Workspace entity
Module: Workspaces (Drupal Core)
Class: Drupal\workspaces\Entity\Workspace
List of base field definitions:
- id: (string) The workspace ID.
- uuid: (uuid) UUID.
- revision_id: (integer) Revision ID.
- uid: (entity_reference to user) The workspace owner.
- label: (string) The workspace name.
- parent: (entity_reference to workspace) The parent workspace.
- changed: (changed) The time that the workspace was last edited.
- created: (created) The time that the workspace was created.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
Module: Custom Menu Links (Drupal Core)
Class: Drupal\menu_link_content\Entity\MenuLinkContent
List of base field definitions:
- id: (integer) The entity ID for this menu link content entity.
- uuid: (uuid) The content menu link UUID.
- revision_id: (integer) Revision ID.
- langcode: (language) The menu link language code.
- bundle: (string) The content menu link bundle.
- revision_created: (created) The time that the current revision was created.
- revision_user: (entity_reference to user) The user ID of the author of the current revision.
- revision_log_message: (string_long) Briefly describe the changes you have made.
- enabled: (boolean) A flag for whether the link should be enabled in menus or hidden.
- title: (string) The text to be used for this link in the menu.
- description: (string) Shown when hovering over the menu link.
- menu_name: (string) The menu name. All links with the same menu name (such as “tools”) are part of the same menu.
- link: (link) The location this menu link points to.
- external: (boolean) A flag to indicate if the link points to a full URL starting with a protocol, like http:// (1 = external, 0 = internal).
- rediscover: (boolean) Indicates whether the menu link should be rediscovered.
- weight: (integer) Link weight among links in the same menu at the same depth. In the menu, the links with high weight will sink and links with a low weight will be positioned nearer the top.
- expanded: (boolean) If selected and this menu link has children, the menu will always appear expanded. This option may be overridden for the entire menu tree when placing a menu block.
- parent: (string) The ID of the parent menu link plugin, or empty string when at the top level of the hierarchy.
- changed: (changed) The time that the menu link was last edited.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- revision_translation_affected: (boolean) Indicates if the last edit of a translation belongs to current revision.
- workspace: (entity_reference to workspace) Indicates the workspace that this revision belongs to.
Paragraph entity
Module: Paragraphs module
Class: Drupal\paragraphs\Entity\Paragraph
Related article: Introduction to paragraphs migrations in Drupal
List of base field definitions:
- id: (integer) ID.
- uuid: (uuid) UUID.
- revision_id: (integer) Revision ID.
- langcode: (language) The paragraphs entity language code.
- type: (entity_reference to paragraphs_type) Paragraph type.
- status: (boolean) Published.
- created: (created) The time that the Paragraph was created.
- parent_id: (string) The ID of the parent entity of which this entity is referenced.
- parent_type: (string) The entity parent type to which this entity is referenced.
- parent_field_name: (string) The entity parent field name to which this entity is referenced.
- behavior_settings: (string_long) The behavior plugin settings
- default_langcode: (boolean) A flag indicating whether this is the default translation.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- revision_translation_affected: (boolean) Indicates if the last edit of a translation belongs to current revision.
- workspace: (entity_reference to workspace) Indicates the workspace that this revision belongs to.
List of field storage configurations:
- field_reusable_paragraph: entity_reference field.
Paragraphs library item entity
Module: Paragraphs Library (part of paragraphs module)
Class: Drupal\paragraphs_library\Entity\LibraryItem
List of base field definitions:
- id: (integer) ID.
- uuid: (uuid) UUID.
- revision_id: (integer) Revision ID.
- langcode: (language) Language.
- revision_created: (created) The time that the current revision was created.
- revision_uid: (entity_reference to user) The user ID of the author of the current revision.
- revision_log: (string_long) Briefly describe the changes you have made.
- status: (boolean) Published.
- label: (string) Label.
- paragraphs: (entity_reference_revisions) Paragraphs.
- created: (created) The time that the library item was created.
- changed: (changed) The time that the library item was last edited.
- uid: (entity_reference to user) The user ID of the library item author.
- default_langcode: (boolean) A flag indicating whether this is the default translation.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- revision_translation_affected: (boolean) Indicates if the last edit of a translation belongs to current revision.
- workspace: (entity_reference to workspace) Indicates the workspace that this revision belongs to.
Profile entity
Module: Profile module
Class: Drupal\profile\Entity\Profile
List of base field definitions:
- profile_id: (integer) ID.
- uuid: (uuid) UUID.
- revision_id: (integer) Revision ID.
- type: (entity_reference to profile_type) Profile type.
- revision_created: (created) The time that the current revision was created.
- revision_user: (entity_reference to user) The user ID of the author of the current revision.
- revision_log_message: (string_long) Briefly describe the changes you have made.
- status: (boolean) Whether the profile is active.
- uid: (entity_reference to user) The user that owns this profile.
- is_default: (boolean) Whether this is the default profile.
- data: (map) A serialized array of additional data.
- created: (created) The time when the profile was created.
- changed: (changed) The time when the profile was last edited.
- revision_default: (boolean) A flag indicating whether this was a default revision when it was saved.
- workspace: (entity_reference to workspace) Indicates the workspace that this revision belongs to.
Group entity
Module: Group
Class: Drupal\group\Entity\Group
List of base field definitions:
- id: (integer) ID.
- uuid: (uuid) UUID.
- langcode: (language) Language.
- type: (entity_reference to group_type) Group type.
- uid: (entity_reference to user) Group creator. The username of the group creator.
- label: (string) Title.
- created: (created) Created on. The time that the group was created.
- changed: (changed) Changed on. The time that the group was last edited.
- default_langcode: (boolean) Default translation. A flag indicating whether this is the default translation.
Group content entity
Module: Group
Class: Drupal\group\Entity\GroupContent
List of base field definitions:
- id: (integer) ID.
- uuid: (uuid) UUID.
- langcode: (language) Language.
- type: (entity_reference to group_content_type) Group content type.
- uid: (entity_reference to user) Group content creator. The username of the group content creator.
- gid: (entity_reference to group) Parent group. The group containing the entity.
- entity_id: (entity_reference to node) Content. The entity to add to the group.
- label: (string) Title.
- created: (created) Created on. The time that the group content was created.
- changed: (changed) Changed on. The time that the group content was last edited.
- default_langcode: (boolean) Default translation. A flag indicating whether this is the default translation.
List of field storage configurations:
- group_roles: entity_reference field.
Module: Webform
Class: Drupal\webform\Entity\WebformSubmission
List of base field definitions:
- serial: (integer) Serial number. The serial number of the webform submission entity.
- sid: (integer) Submission ID. The ID of the webform submission entity.
- uuid: (uuid) Submission UUID. The UUID of the webform submission entity.
- token: (string) Token. A secure token used to look up a submission.
- uri: (string) Submission URI. The URI the user submitted the webform.
- created: (created) Created. The time that the webform submission was first saved as draft or submitted.
- completed: (timestamp) Completed. The time that the webform submission was submitted as complete (not draft).
- changed: (changed) Changed. The time that the webform submission was last saved (complete or draft).
- in_draft: (boolean) Is draft. Is this a draft of the submission?
- current_page: (string) Current page. The current wizard page.
- remote_addr: (string) Remote IP address. The IP address of the user that submitted the webform.
- uid: (entity_reference to user) Submitted by. The username of the user that submitted the webform.
- langcode: (language) Language. The submission language code.
- webform_id: (entity_reference to webform) Webform. The associated webform.
- entity_type: (string) Submitted to: Entity type. The entity type to which this submission was submitted from.
- entity_id: (string) Submitted to: Entity ID. The ID of the entity of which this webform submission was submitted from.
- locked: (boolean) Locked. A flag that indicates a locked webform submission.
- sticky: (boolean) Sticky. A flag that indicate the status of the webform submission.
- notes: (string_long) Notes. Administrative notes about the webform submission.
Available properties for other content entities
This reference includes all core content entities and some provided by contributed modules. The next article will include a reference for Drupal Commerce content entities. That being said, it would be impractical to cover all contributed modules. To get a list of yourself for other content entities, load the `entity_type.manager` service and call its `getFieldStorageDefinitions()` method passing the machine name of the entity as a parameter. Although this reference only covers content entities, the same process can be used for configuration entities.
What did you learn in today’s article? Did you know that there were so many entity properties in Drupal core? Were you aware that the list of available properties depend on factors like if the entity is fieldable, translatable, and revisionable? Did you know how to find properties for content entities from contributed modules? Please share your answers in the comments. Also, we would be grateful if you shared this article with your friends and colleagues.