Skip to content

Allow restricting subtypes and classes in link edit panel#1078

Merged
kingjia90 merged 7 commits into
pimcore:2.3from
jdreesen:openLinkEditPanel-subtypes
Jun 29, 2026
Merged

Allow restricting subtypes and classes in link edit panel#1078
kingjia90 merged 7 commits into
pimcore:2.3from
jdreesen:openLinkEditPanel-subtypes

Conversation

@jdreesen

Copy link
Copy Markdown
Contributor

Now that we finally upgraded to Pimcore 11 and I can use this feature, I noticed that we forgot to support subtypes and classes in pimcore/pimcore#13173 😞

I hope that it counts as a bugfix and can still be merged.

Note

This is a reincaration of #1057, which has accidentally been merged and reverted.

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings June 22, 2026 14:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the classic admin UI’s link edit panel to support Pimcore 11’s ability to restrict selectable link targets by element subtype (asset/document/object subtypes) and by object class, aligning the UI behavior with newer core capabilities.

Changes:

  • Added configuration options to the Link class definition UI for allowed subtypes and allowed object classes.
  • Passed the new restriction settings from object link tags into the link edit panel config.
  • Enforced subtype/class restrictions in the link edit panel for drag & drop and item selector search.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
translations/admin_ext.en.yaml Adds new translation keys for the new “allowed subtypes” labels.
public/js/pimcore/object/tags/link.js Builds and forwards allowedSubtypes / allowedClasses config into the link edit panel.
public/js/pimcore/object/classes/data/link.js Adds Link field configuration UI for subtype/class restrictions (but currently introduces a broken MultiSelect store shape).
public/js/pimcore/helpers.js Applies the subtype/class restrictions in the link edit panel (DnD + search selector restrictions).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread public/js/pimcore/object/classes/data/link.js
Comment thread public/js/pimcore/object/classes/data/link.js
Comment thread public/js/pimcore/object/classes/data/link.js
Comment thread public/js/pimcore/object/classes/data/link.js
Comment thread public/js/pimcore/object/classes/data/link.js
Comment thread public/js/pimcore/object/classes/data/link.js
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 29, 2026 10:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread public/js/pimcore/object/classes/data/link.js
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Revert .map((text) => ({text})) wrapping on all string-array stores.
Ext.ux.form.MultiSelect expects a plain 1D string array for its internal
ArrayStore conversion; passing {text} objects caused blank/broken display.
Apply the same to the new subtype stores (filter only, no map).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Fix subtype/class restriction bypasses in openLinkEditPanel

- Both search buttons now share `searchRestriction` (the always-visible
  inline button was missing subtype/class params, bypassing all restrictions)
- `allowedSubtypes` is null when unconfigured so the search dialog's own
  defaults are not overridden for fields with no subtype config
- Folder-only subtype restriction now correctly yields an empty intersection
  instead of silently falling back to all subtypes
- Explicit `data.type === "folder"` guard in `dndAllowed` for clarity

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@jdreesen

Copy link
Copy Markdown
Contributor Author

@kingjia90 thx for finishing this :)

@kingjia90

Copy link
Copy Markdown
Contributor

@kingjia90 thx for finishing this :)

let's thank Claude and Copilot for the moment 😏 i still have to review and test it

@kingjia90 kingjia90 merged commit e57c974 into pimcore:2.3 Jun 29, 2026
12 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 29, 2026
@jdreesen jdreesen deleted the openLinkEditPanel-subtypes branch June 29, 2026 14:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants