Add support for #cardinality (allowed number of values) to fields created programmatically with the type 'managed_file'

Created on 10 February 2019, almost 6 years ago
Updated 4 May 2023, over 1 year ago

Problem/Motivation

The field with the type 'managed_file' created programmatically does not respect the property '#cardinality' (allowed number of values). The limit for multivalue custom fields can not be set.

The following field has no limit despite the parameter '#cardinality' is set to 3.

$form['custom_file'] = [
  '#type' => 'managed_file',
  '#multiple' => TRUE,
  '#upload_location' => 'public://photos',
  '#cardinality' => 3,
];

Proposed resolution

Add support for #cardinality to fields created programmatically with the type 'managed_file'.

Remaining tasks

Add tests.

Feature request
Status

Needs work

Version

10.1

Component
File system 

Last updated about 2 hours ago

Created by

🇵🇱Poland Krzysztof Domański Poland

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

Production build 0.71.5 2024