New config schema data type: bytes

Created on 19 February 2024, 11 months ago
Updated 11 March 2024, 10 months ago

Problem/Motivation

There are a number of places in Drupal core and contrib have configuration that specifies a certain amount of bytes: from memory limits to maximum file sizes, to minimum file sizes, to upload limits, and so on.

In Drupal core there are at least two use cases:

  1. type: editor.editor.* has a image_upload.max_size key β€” used to indicate max image file size
  2. type: base_file_field_field_settings has a max_file_size key β€” used to indicate the max file size for file fields

There's lots of contrib use cases for this too β€” I spotted one in Webform for example.

Steps to reproduce

N/A

Proposed resolution

  1. A new type: bytes
  2. A new CallbackValidator callback: \Drupal\Component\Utility\Bytes::validateConstraint()

Remaining tasks

Review.

User interface changes

None.

API changes

Two API additions:
No changes, but 2 API additions:

  1. A new type: bytes config schema type, see CR: https://www.drupal.org/node/3416738 β†’ . (We'll be able to use that for base_file_field_field_settings.max_filesize too. There's lots of contrib use cases for this too β€” I spotted one in Webform for example.
  2. πŸ‘† that required adding \Drupal\Component\Utility\Bytes::validateConstraint()

Data model changes

None.

Release notes snippet

None.

✨ Feature request
Status

Fixed

Version

10.3 ✨

Component
ConfigurationΒ  β†’

Last updated about 17 hours ago

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

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