Problem/Motivation

When I try to add a CSS Size field in a content type, it shows an error.

Steps to reproduce

1: Install the "Css size field" using the following command:
composer require 'drupal/css_size_field:^1.0@beta'

2: Add a CSS Sixe field to any content type.

3: The following error appears:

InvalidArgumentException: Invalid weight unit "" provided. in Drupal\css_size_field\SizeUnit::assertExists() (line 62 of modules\contrib\css_size_field\src\SizeUnit.php).

CommentFileSizeAuthor
css.png97.54 KBaman_lnwebworks
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

aman_lnwebworks created an issue. See original summary.

anirudhsingh19’s picture

Assigned: Unassigned » anirudhsingh19

working on it!!

anirudhsingh19’s picture

Assigned: anirudhsingh19 » Unassigned
Status: Active » Needs review

The issue was caused because there was no validation to check $default_value['unit'] for being empty in /src/Element/CssSize.php. Changes have resolved the issue. Moving it to NR.

goz’s picture

Status: Needs review » Fixed
Issue tags: +Drupalcon Chicago 2026

Thank you for your work

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.

rachel_norfolk’s picture

Issue tags: -Drupalcon Chicago 2026 +Chicago2026

Correcting the issue tag for DrupalCon

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.