Allow bypassing paragraph type restrictions on Library items

Created on 26 April 2023, over 1 year ago
Updated 31 October 2023, about 1 year ago

Problem/Motivation

A field cannot contain Paragraph Library items that contain paragraphs that are not allowed to be selected directly for that field.

In the simplest illustration of this, a field that ONLY allows library items and nothing else cannot be saved, it must also allow whichever paragraph types the selected library items contain.

The existing logic make sense considering that, otherwise, using a library item would bypass all paragraph type restrictions, but not having at least a toggle for it is baffling since creating fields that ONLY allow predefined paragraphs would presumably be a primary use case for this sub-module.

Steps to reproduce

  • Create a paragraph type .
  • Create a library item consisting of a paragraph of type .
  • Create a field of type Entity Reference Revisions on any entity type, and only allow "From library" on it.
  • Create an instance of that entity type and select the library item for the field .
  • Saving the entity instance will fail with the error message:
    The Reusable paragraph field cannot contain a paragraph, because the parent field disallows it.

Proposed resolution

  • Introduce a toggle "Inherit paragraph type restrictions on library items" (default: "On") in the "selection of paragraph types" section for the field edit page (either next to the "From library" toggle when it is "On", or at the bottom).
  • Introduce a toggle "Inherit paragraph type restrictions from the parent entity" (default: "On") on the library item edit page.
  • Ideally, both of these should be implemented for greater control.

    By defaulting this toggle to "On" we avoid potentially exposing unwanted paragraph types for data created prior to this change (See related issue #2975831).

    Remaining tasks

    User interface changes

    API changes

    Data model changes

    ✨ Feature request
    Status

    Active

    Version

    1.15

    Component

    Module: Library

    Created by

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

    Comments & Activities

    Not all content is available!

    It's likely this issue predates Contrib.social: some issue and comment data are missing.

    • πŸ‡ΊπŸ‡ΈUnited States amaisano Boston

      We need this.

      The use case is simple and surprisingly necessary:

      We ONLY want "reusable" paragraphs to be used in the ERR field. There should be no "direct" ERR (non From Library type) paragraphs directly attached to the node.

      It's impossible to do this without allowing ALL paragraph types, which completely confuses our contributors who have added things directly and should not be able to.

      I believe this is a regression from how this worked in D8, but I could be wrong.

    Production build 0.71.5 2024