Use EntityBrowserDisplay url instead of hardcoded url

Created on 6 May 2024, 8 months ago
Updated 23 May 2024, 7 months ago

Problem/Motivation

The entity_browser module has entity browsers linked to Entity Browser Displays (Iframe, Modal, Standalone), but it's also possible to create your own by implementing the EntityBrowserDisplay plugin.
When implementing such an EntityBrowserDisplay plugin, you can define the url that should be used to display the entity browser.

This module however _hardcodes_ the url to the entity browser, using `/entity-browser/modal/${key}` in its ckeditor 5 javascript plugin.
This is a problem when you define your own EntityBrowserDisplay plugin or alter an existing plugin.

Steps to reproduce

Create a custom EntityBrowserDisplay plugin and try to use it in the ckeditor 5 plugin.
You'll notice that the entity browser will not open because of a 404 error.
The ckeditor5 plugin is hardcoded to use `/entity-browser/modal/${key}`.

Proposed resolution

Read the url from the EntityBrowserDisplay plugin and pass it to the ckeditor 5 javascript plugin through drupalSettings config.
Use this url in the ckeditor5 javascript plugin to open the entity browser instead of hardcoding `/entity-browser/modal/${key}`

User interface changes

None.

API changes

Nothing that breaks backwards compatibility.
The HOOK_ckeditor5_entity_browser_definitions alter can now be used to alter the url that is used to open the entity browser.

Data model changes

None.

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇧🇪Belgium Robin.Houtevelts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024