Problem/Motivation

When paragraph types have paragraphs_categories third-party settings referencing category entities that no longer exist (or were never created), those paragraph types are grouped into phantom/non-existent category groups instead of falling back to the "Uncategorized" (_none) group.

This causes the paragraph type buttons in the modal dialog to appear in an unexpected order rather than respecting the weight/order configured in the entity reference field settings (target_bundles_drag_drop).

This can happen when:

Category entities are deleted but the paragraph type third-party settings are not cleaned up.
Configuration is imported from another environment where categories existed.
A module sets paragraphs_categories third-party settings without creating the corresponding category entities.

Steps to reproduce

Create a paragraph entity reference field with multiple paragraph types and configure their order via drag-and-drop weights.
On any paragraph type edit form, assign it to a category (e.g., layout_components).
Delete the category entity (or never create it in the first place) while the paragraph type still references it.
Edit a node with the paragraph field and open the "Add component" modal dialog.
Observe that the paragraph types do not appear in the expected field weight order — they are scattered into invisible groups.

Validate that referenced paragraph category entities actually exist before using them to group paragraph type buttons. Load all existing category entity IDs once before the loop and filter out orphaned references using array_intersect(). Paragraph types referencing non-existent categories will correctly fall back to the _none (Uncategorized) group and respect the configured field weight ordering.

Remaining tasks

Review and test the patch.
Consider whether a post_update hook should clean up orphaned paragraphs_categories third-party settings from paragraph type entities.

User interface changes

None. Paragraph type buttons will now appear in the correct order as configured in the field settings when categories are missing.

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

yaswanth pamuru created an issue. See original summary.

stborchert’s picture

Version: 10.0.6 » 10.1.x-dev
Status: Active » Needs work

Hi. Thanks for reporting this.
We don't do patches anymore, please create a merge request against branch 10.1.x.

  • d6ab54b4 committed on 10.1.x
    fix: #3600992 Paragraph types with orphaned category references ignore...
stborchert’s picture

Status: Needs work » 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.