Allow numeric limit per region

Created on 4 July 2023, over 1 year ago

Problem/Motivation

It can be useful to limit paragraphs numerically.

Use cases from my own experience:

  1. "boxy" CSS grid layouts where every one grid child = one region must contain exactly one child, to enforce top and bottom alignment across the entire grid.
    Example grid with size-aligned children
  2. "Description - List" layouts
    E.g. a 2 column layout where the left column must contain exactly one description or title paragraph and the right column contains multiple items.
    Example layout from one of my projects with multiple list items on left and single description on right (on large screens)

Proposed resolution

Add an integer config setting numeric_limit per region

disallowed_types:
  layout_name:
    region_name:
      negate: true
      paragraph_types: { }
      numeric_limit: 123

In case of nested layouts: The limit validator will count direct children only.

User interface changes

Add number input below bundle checkboxes for every region.

Screenshot coming soon...

Data model changes

Yes, see proposed resolution

Other notes

It is technically possible to limit number of children on the paragraph host field. Similar to a bundle filter on the host field, this setting can not overrule the host field setting.

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria hudri Austria

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