Problem/Motivation

The CKEditor 5 dialog offers every component of the site. A site builder may want to limit a text format to a few of them, and the limit must also hold for text written in source mode or through the API, not only in the dialog.

Proposed resolution

Add an "Allowed components" setting to the component_embed filter: checkboxes grouped by module or theme, none checked means all allowed. The filter drops a component outside the list when rendering, the dialog only offers the allowed ones and refuses a component outside the list, the preview returns 403 for it.

Component_form element gets a #component_filter option. The selected component always stays in the list so a saved configuration remains editable. The matching lives in ComponentPluginManager::filterDefinitions() so other modules and slot restrictions from #3551587: Slots restrictions according to suggestions and cardinality would reuse it.

Nested components inside a slot are not restricted, a follow-up ?

API changes

New #component_filter option on the component_form element. New ComponentPluginManager::filterDefinitions() method. New allowed_components setting on the component_embed filter.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

just_like_good_vibes created an issue. See original summary.

just_like_good_vibes’s picture

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Active » Needs review

i implemented the component restrictions for nested components
the component_filter proposition is also made in #3551587: Slots restrictions according to suggestions and cardinality, depending on which one we want to merge first

just_like_good_vibes’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.