Drupal Entity Embed Module: How to Install and Use (With Key Features)

Drupal entity embed

Creating rich, dynamic content can be challenging when traditional content management tools limit flexibility and reusability. For Drupal users, this often results in time wasted on repetitive tasks like manually embedding related content, media, or user profiles. This inefficiency reduces productivity and creates inconsistencies across pages.

So, what’s the solution? Using Drupal Entity Embed module. It simplifies embedding any Drupal entity directly into your content with a WYSIWYG editor like CKEditor.

In this blog, we’ll understand what Entity Embed module is and what its use is. We’ll help you learn how Drupal development experts install, configure and use it. Plus, we’ll explore some of the common use cases of the Drupal Entity Embed module. With that said, let’s get started!

What are Drupal Entities?

In Drupal, entities are the fundamental building blocks of content and configuration. They represent a structured way of storing and organizing data within a Drupal site. Entities can include various types of data, such as content, user profiles, or configuration items, and they are designed to be flexible, reusable, and extendable.

Types of Embedding Entities in Drupal

  • Nodes: The most common type of entity is the node, which represents content like articles, pages, blog posts, and other content types. Nodes are flexible and can be customized with additional fields such as text, images, or videos, depending on the content type.
  • Users: The user entity stores information about users on the site, such as usernames, passwords, roles, and permissions. Users are a special type of entity in Drupal and play a key role in managing access to various features on the site.
  • Taxonomy Terms: These entities are used for categorizing and managing taxonomy. They are organized into vocabularies and allow you to categorize content items based on specific attributes (e.g., tags, categories).
  • Media: The media entity stores information about multimedia content, such as images, videos, audio files, or documents. The Media library in Drupal extends this entity type to support more complex media management features.
  • Custom Entities: Drupal allows developers to create custom entities tailored to specific needs. These could be anything from event calendars to product listings, and they can include custom fields and properties.

By effectively embedding these entities, you can create a more interconnected and engaging user experience on your Drupal website.

What is Drupal Entity Embed and Why Use it?

Drupal Entity Embed is a module that allows you to integrate various Drupal entities (like nodes, users, terms) into content fields using a WYSIWYG editor like CKEditor. The embedded entities are managed as part of the content, ensuring consistency and enabling reusable components across a site.

By leveraging the Entity Embed module, site builders and content creators can create rich, dynamic content without custom coding. Some of the key reason why you should use it are:

  • Enhanced Content Flexibility: With Entity Embed, content authors can easily insert dynamic content (e.g., images, videos) into their pages. This is especially valuable for creating rich, interrelated content without needing to manually copy URLs or HTML embed codes.
  • Reusability of Content: Embedding entities allows for better content reusability. For instance, if a node is embedded multiple times within different pages, any updates to the original node will be reflected automatically wherever it’s embedded. This feature ensures consistent and up-to-date content.
  • Improved Media Integration: Entity Embed works seamlessly with Drupal’s Media module. It provides an easy way to embed media entities (e.g., images, videos, documents) into text areas using CKEditor. This makes the process of managing and displaying media content more efficient.
  • Streamlined Workflow for Content Editors: The module simplifies the content editing process. With Entity Embed, content creators can select from available entities via an intuitive interface, without needing technical expertise. This is particularly useful for content creators who are not familiar with Drupal’s backend systems.
  • Support for Complex Entity Relationships: By embedding entities, you can easily create complex relationships between different content types. For example, embedding a related article (node) into another article helps establish a content hierarchy and improves navigation for users.

Using Drupal Entity Embed is beneficial for websites aiming to enhance content management and presentation. It bridges the gap between structured data and unstructured content, enabling developers to build rich, dynamic pages with ease.

Struggling to build an interactive and dynamic Drupal website?

How to Install and Enable the Drupal Entity Embed Module?

Installing and enabling the Drupal Entity Embed module involves several steps, including downloading the module and configuring its dependencies. Below is a complete stepwise guide to help you through the process.

Step 1: Verify Prerequisites

Before proceeding, confirm that your Drupal installation meets the necessary prerequisites. The Entity Embed module relies on a functional Drupal installation and CKEditor, the WYSIWYG editor included with Drupal core.

  • Ensure you have a running Drupal 8, 9, or 10 site.
  • Check that CKEditor is enabled by navigating to Extend (/admin/modules) and verifying that the CKEditor module is active.

Here, we’ve ensured your site is ready for the module installation, preventing potential compatibility issues.

Step 2: Download the Entity Embed Module

You can download the Entity Embed module either by using Composer or manually from Drupal.org.

  • To install it using Composer, open your terminal or command line interface and run the following command to download the module:

composer require drupal/entity_embed

  • Alternatively, you can download the module manually from the Entity Embed project page on Drupal.org. Extract the downloaded ZIP file into your Drupal site’s /modules/contrib directory.

The Entity Embed module is now downloaded and available for activation in your Drupal installation.

Step 3: Install the Module Using the Admin Interface

Once the module files are in place, you need to install it via the Drupal admin interface.

  • Navigate to Extend in the admin menu (/admin/modules).
  • In the search bar, type “Entity Embed” to quickly find the module.
  • Check the box next to Entity Embed.
  • Scroll down and click the Install button.

Here, we used the Drupal admin interface to install the Entity Embed module by enabling it in the module list.

Step 4: Configure CKEditor to Use Entity Embed

Entity Embed works best with the CKEditor text editor for embedding entities directly into content. After installing the module, you need to configure CKEditor integration.

  • Go to Configuration > Content Authoring > Text formats and editors (/admin/config/content/formats).
  • Select the text format you want to enable Entity Embed for (usually Full HTML or Basic HTML).
  • Click Configure next to the selected text format.
  • In the CKEditor settings, under the Enabled plugins section, ensure that Entity Embed is checked.
  • Save your configuration.

This step ensures that the CKEditor is configured to use the Entity Embed plugin, allowing you to embed entities directly through the WYSIWYG editor.

Step 5: Test Entity Embedding in Content

Now that the module is installed and configured, it’s time to test embedding entities in your content.

  • Go to Content > Add content and select a content type (e.g., Article).
  • In the body field (assuming CKEditor is enabled), click the Entity Embed button on the toolbar (it looks like a small icon or button that allows you to embed entities).
  • In the pop-up, select the type of entity you want to embed (e.g., a media file, node, or taxonomy term).
  • Choose the specific entity (e.g., select a node or image) and click Insert.
  • Save the content.

We tested the entity embedding feature by adding a new piece of content and embedding an entity directly into the body field using CKEditor.

Step 6: Review and Manage Permissions

Finally, you may want to manage the permissions for who can embed entities on your site. By default, only certain user roles can use the Entity Embed feature.

  • Navigate to People > Permissions (/admin/people/permissions).
  • Search for Entity Embed permissions.
  • Enable or disable permissions based on user roles. For example, you can grant permissions to content editors or site administrators to embed entities.
  • Save the permissions settings.

In this step, we configured user role permissions ensuring the embed entity feature is available to the appropriate roles.

Step 7: Clear Cache

After installation and configuration, it’s a good practice to clear Drupal’s cache to ensure all changes are properly applied.

  • Go to Configuration > Performance (/admin/config/development/performance).
  • Click the Clear all caches button.

Here, we cleared Drupal’s cache to ensure that all configurations and settings are applied correctly and that Entity Embed functions as expected.

By following these steps, you will have a successfully installed, enabled, and configured Drupal Entity Embed module. If you are looking to build a dynamic and interactive site with the best practices followed, get in touch with our Drupal development company.

Using Entity Embed in Drupal

Once you have installed and enabled the Drupal Entity Embed module, you can start using it to embed entities within your content. Below is a stepwise guide on how to use Entity Embed in Drupal and managing embedded entities.

Step 1: Prepare Your Content

Before embedding an entity, ensure you are editing content with a CKEditor-enabled field where the Entity Embed button is available.

  • Navigate to Content > Add content or select an existing content item to edit.
  • Locate the body or any other rich-text field configured with CKEditor.

With that, we are now ready to embed an entity in a compatible field using CKEditor.

Step 2: Access the Entity Embed Tool

The Entity Embed module integrates with CKEditor by adding a button to the toolbar, allowing users to embed entities.

  • Open the text editor where you want to embed the entity.
  • Look for the Entity Embed button (often represented by an icon resembling a link or item insertion).
  • Click on the button to open the Entity Embed dialog box.

The Entity Embed tool is now active and ready for us to select an entity.

Step 3: Select an Entity to Embed

This step involves choosing the type of entity (e.g., node, media, taxonomy term) and the specific item you wish to embed.

  • In the Entity Embed dialog box, select the Entity Type (e.g., Node, Media, User).
  • Use the search or filter options to locate the specific entity you want to embed.
  • Click on the entity to select it.

Here we have chosen the entity we want to embed in our content.

Step 4: Configure Entity Display Options

The module provides options to customize how the embedded entity appears in your content.

  • After selecting the entity, choose the View Mode (e.g., Full, Teaser, Custom).
  • Set additional parameters if available, such as alignment, size, or styling preferences.
  • Review the preview (if provided) to confirm your settings.

Now, the embedded entity’s appearance and behavior are now configured to your specifications.

Step 5: Insert the Entity

After configuring the display settings, the entity is ready to be embedded into your content.

  • Click the Insert button in the dialog box.
  • The entity placeholder or markup will appear within the text editor.

The entity is now embedded in your content and visible within the text editor.

Step 6: Save and Preview Content

Finalize your content and preview the embedded entity to ensure it is displayed as intended.

  • Save the content by clicking Save or Publish.
  • View the saved content in the front-end or preview mode to check how the embedded entity is rendered.

The  embedded entity is successfully displayed in published content, enhancing its interactivity and functionality.

Step 7: Edit or Remove an Embedded Entity

If you need to modify or remove the embedded entity, you can easily do so through the CKEditor interface.

  • Edit the content item containing the embedded entity.
  • Locate the placeholder or embedded entity in the CKEditor field.
  • Click on the placeholder to edit its properties or delete it.
  • Save the content after making changes.

With that, we’ve successfully modified or removed an embedded entity.

Using the Entity Embed module in Drupal is a simple process that can enhance the flexibility of your content creation. By following the above steps, you can embed and customize various entities and make your Drupal site interactive.

Key Features of Drupal Entity Embed

The Drupal Entity Embed module comes with a variety of powerful features that make it an essential tool for managing and embedding entities within content. Here are some of its key features:

Embed Any Drupal Entity

Entity Embed allows embedding a variety of Drupal entities into content, including nodes, taxonomy terms, and custom entities. This feature enables dynamic content integration, such as embedding images, videos, and related pages directly into articles. This flexibility allows content creators to insert various types of data enhancing content richness and interactivity.

CKEditor Integration

The module integrates directly with CKEditor, providing a WYSIWYG interface for embedding entities. Content authors can select entities and insert them into their text without needing to write code or manually handle URLs. This simplifies the embedding process for non-technical users. It makes entity embedding easy and efficient within the content creation workflow.

Inline Embedding

With Entity Embed, you can embed entities directly within text, maintaining the flow of your content. This inline embedding allows for a more natural integration of images, videos, or nodes within paragraphs. It eliminates the need for separate sections or blocks for embedded content. This feature enhances content presentation and makes pages feel more cohesive.

Entity Reference Field Type

Entity Embed extends Drupal’s Entity Reference field type, enabling content editors to embed entities directly. Using this feature, entities like media or taxonomy terms can be referenced and displayed in the content area. It integrates well with Drupal’s field system, ensuring consistent management of embedded content. This ensures the related content is displayed in a structured way.

Dynamic Updates

Changes made to the original entity automatically reflect in any content where it’s embedded. This ensures that updates, like modifying an image or text, are propagated site-wide without needing manual updates. It simplifies content maintenance and reduces the risk of outdated information being displayed. This dynamic linking keeps content consistent and current.

Flexible Embedding Options

Entity Embed provides different ways to embed entities, such as embedding an entire node or selecting specific fields, like an image or a title. This flexibility allows content creators to choose how much or how little of an entity is displayed. Multiple instances of the same entity can also be embedded enhancing content reusability and customization.

Multilingual Support

Entity Embed is compatible with Drupal’s multilingual capabilities, ensuring entities are embedded correctly in different languages. Embedded content can be localized, ensuring a seamless experience for users across regions. This is particularly useful for sites targeting diverse language audiences.

Integration with Other Modules

Entity Embed integrates smoothly with other Drupal modules like Media, Paragraphs, and Views. This enhances its functionality, allowing embedded content to interact with other content elements and display options. For instance, embedding a media entity or integrating it with Views displays content dynamically.

These key features combine to make Drupal Entity Embed a valuable tool for creating dynamic and interconnected content in Drupal.

Use Cases for Drupal Entity Embed Module

The Drupal Entity Embed module offers a wide range of use cases that can significantly enhance the functionality and user experience of your site. Here are some practical use cases for the Entity Embed module:

Media Embedding

Embed media entities like images, videos, or audio files from the media library directly into content.

Benefits:

  • Centralized media management ensures consistency.
  • Reusability of media assets across multiple pages.
  • Seamless integration with responsive layouts for an optimal user experience.

Example: A blog post about a product can include embedded product images or demonstration videos, directly from the media library.

Node Embedding

Embed full or teaser displays of nodes, such as articles, blog posts, or custom content types.

Benefits:

  • Facilitates cross-referencing related content.
  • Improves navigation and user engagement.
  • Saves time by automating updates to related content as nodes are edited.

Example: A landing page for a marketing campaign embeds teasers for related blog posts or case studies to provide additional context.

Embedding Taxonomy Terms

If you have a content type like a blog or article, you can use the Entity Embed module to embed taxonomy terms (tags or categories) that categorize or tag your content.

Benefits:

  • Enhances content categorization and discoverability.
  • Improves Drupal SEO by linking relevant terms to detailed taxonomy pages.
  • Enables precise organization of content for niche topics and long-tail keywords.

Example: An article on gardening tips embeds taxonomy terms like “Vegetables,” “Fruits,” or “Herbs,” linking readers to related topics.

Product and Service Showcases

Embed eCommerce entities such as products, service offerings, or pricing plans directly into promotional content.

Benefits:

  • Creates visually appealing, actionable content without duplicating data.
  • Simplifies updates to product/service information in one place.
  • Improves conversion rates with direct access to product information.

Example: A sales page embeds teasers for individual products with descriptions, pricing, and a “Buy Now” button.

Call-to-Action Enhancements

Embed call-to-action elements like forms, buttons, or promotional banners using entities.

Benefits:

  • Streamlines marketing campaigns with reusable CTAs.
  • Enhances user interaction by integrating engaging CTAs within content.
  • Tracks engagement metrics more effectively by centralizing call-to-action management.

Example: A blog post embeds a subscription form for a newsletter at the end of the content.

Each of these use cases highlights how the module can be leveraged to streamline content management and create a more dynamic user experience.

Need expert assistance with your Drupal project?

FAQs About Drupal Entity Embed Module

Can I customize the display of embedded entities?
Yes, you can customize how embedded entities appear by configuring view modes in Drupal. This allows you to control fields and formatting for each entity type.
What entities can be embedded with the Entity Embed module?
You can embed various entities like nodes, media, taxonomy terms, users, comments, and custom entities. The module provides flexibility for integrating diverse content types.
Do I need coding skills to use the Entity Embed module?
No coding skills are required. Content creators can embed entities using the WYSIWYG editor's "Insert Entity" button without technical knowledge.

Wrapping Up

The Drupal Entity Embed module simplifies content creation by enabling the embedding of entities like nodes, media, and more into text fields. Using it not only saves time but also ensures consistency across pages, making content more dynamic and engaging.

By understanding Drupal entities and the module’s key features, you can use the module to embed multimedia and integrate user profiles. It’s easy installation and customization options make it a good option for developers and content creators alike. Plus, using the Entity Embed module enables you to build scalable solutions efficiently.

If you are looking to build a well-designed, robust, and scalable web solution, hire Drupal developers.

author
Mayur Upadhyay is a tech professional with expertise in Shopify, WordPress, Drupal, Frameworks, jQuery, and more. With a proven track record in web development and eCommerce development.

Leave a comment