Automatic Entity Linking, Smart Suggestions, and Linkit-style UX — Now in Core
Drupal 11.3 introduces a long-awaited feature: native support for linking to entities directly from CKEditor 5, powered by a new Entity Links text filter and a built-in Entity Link Suggestions Plugin.
If you ever used Linkit, this will feel very familiar — but now it’s supported natively by Drupal core and integrated with the new Link Target Handlers architecture.
This article walks through what the feature does, how to enable it, how to extend it, and how to expose custom entity types as suggestions.
🌟 What This Feature Solves
Historically, when editors wanted to link to content:
- You had to manually copy/paste URLs
- It was easy to mistype links
- Linking to Media, Taxonomy, or Files required custom modules
- Linkit was the only real solution
Now Drupal 11.3 finally solves all this.
With the new CKEditor 5 Entity Links plugin, editors can:
- Type “/” or “[[” and instantly get searchable entity suggestions
- Link to nodes without knowing their URLs
- Link to media, taxonomy terms, menu links, or custom entities
- Rely on correct URL generation via Link Target handlers
No more broken internal URLs.
No more /node/### guesses.
No more route mishandling.
🆕 Part 1 — The Entity Links Filter
A new text filter is added to core:
Entity Links Filter
This filter is responsible for handling the special markup inserted by CKEditor 5, converting it into real active links when rendering content.
How to Enable It
- Go to
Configuration → Content authoring → Text formats and editors - Edit any CKEditor 5 format (e.g., “Full HTML”)
- Enable the checkbox:
✔ Entity Links
You should now see a new filter in the list.
🆕 Part 2 — CKEditor 5 Link Suggestions Plugin
Once the filter is enabled, CKEditor 5 activates the new UI for entity linking.
When typing inside CKEditor:
- Type
[[or - Type
/(depending on config)
Drupal opens a live-search dialog of entities.
By default, only Nodes appear.
To enable other entity types — like Taxonomy, Media, Menu Links, or custom entities — modules must add a specific bundle flag.
🧩 Enabling Other Entity Types
Drupal introduces a new bundle-level setting:
'ckeditor5_link_suggestions' => TRUE
You can enable it manually for a few bundles, or globally for an entire entity type.
🛠️ Example: Enabling Link Suggestions for Media + Taxonomy
Create the file:
src/Hook/MyModuleHooks.php
<?php
declare(strict_types=1);
namespace Drupal\my_module\Hook;
use Drupal\Core\Hook\Attribute\Hook;
/
* Hook implementations for my_module.
*/
class MyModuleHooks {
/
* Implements hook_entity_bundle_info_alter().
*/
#[Hook('entity_bundle_info_alter')]
public function entityBundleInfoAlter(array &$bundles): void {
if (isset($bundles['taxonomy_term'])) {
foreach ($bundles['taxonomy_term'] as $key => $bundle) {
$bundles['taxonomy_term'][$key]['ckeditor5_link_suggestions'] = TRUE;
}
}
if (isset($bundles['media'])) {
foreach ($bundles['media'] as $key => $bundle) {
$bundles['media'][$key]['ckeditor5_link_suggestions'] = TRUE;
}
}
}
}
That’s it — now when editors search inside the CKEditor link dialog:
- Media items appear
- Taxonomy terms appear
- Nodes appear as before
🧠 How This Fits With Link Target Handlers
Entity Suggestions + Link Target Handlers work together:
CKEditor 5
|
v
Search entities (via Entity Links plugin)
|
v
Choose entity
|
v
Link Target Handler decides:
- canonical route?
- media file URL?
- oEmbed source?
- menu link URL?
|
v
CKEditor inserts properly generated link
This ensures:
- URLs are always correct
- Media/file links point to the right place
- Menu links don’t break
- Cache metadata is included
🔎 Example of What Users See
Typing:
[[ med...
Shows suggestions like:
Media: Banner Image
Media: Company Logo
Media: Video Interview
Taxonomy: Category – News
Node: About Us
Node: Contact
Selecting an item automatically inserts a link with the correct URL.
🧱 Extending for Custom Entities
If you have a custom entity type like product, simply add:
$bundles['product'][$bundle]['ckeditor5_link_suggestions'] = TRUE;
Now products will appear in CKEditor search suggestions.
In combination with custom Link Target Handlers (introduced earlier), you can fully control the generated URLs.
📦 Example: A Custom Entity + Custom Link Logic
Let’s imagine a custom Event entity.
Enable suggestions:
$bundles['event'][$key]['ckeditor5_link_suggestions'] = TRUE;
Define custom URL resolution (LinkTarget):
class EventLinkTarget implements EntityLinkTargetInterface {
public function getLinkTarget(EntityInterface $entity): GeneratedUrl {
return Url::fromRoute('event.public_view', ['event' => $entity->id()])
->toString(TRUE);
}
}
Now CKEditor displays event suggestions AND links to the public route instead of the canonical one.
🧪 Testing Tips
List all bundles that support link suggestions:
\Drupal::service('entity_type.bundle.info')->getBundleInfo('node');
See if your bundle has the flag:
$bundles['product']['default']['ckeditor5_link_suggestions'] ?? NULL;
Clear caches when modifying bundle info:
drush cr
🏁 Summary
The new Entity Links Filter and CKEditor 5 Link Suggestions Plugin in Drupal 11.3 bring long-missing functionality into core:
- 🔍 Smart search-driven entity linking
- 🔗 Automatic URL generation through Link Target handlers
- ⚙️ Extensible to Media, Taxonomy, Menu, Files, and custom entities
- ❤️ Linkit-like experience, now native in core
- ⚡ Faster and more reliable than contrib solutions
Combined with the new Entity Link Target system, Drupal now provides a complete, extensible, and consistent way to generate internal links across all entity types.
Comments