Fatal error with default value

Created on 17 October 2024, 4 months ago

Problem/Motivation

TypeError : options_allowed_values(): Argument #1 ($definition) must be of type Drupal\Core\Field\FieldStorageDefinitionInterface, null given, called in C:\www\drupal10\web\modules\contrib\select_or_other\src\Plugin\Validation\AllowedValuesConstraintValidator.php on line 122 dans options_allowed_values() (ligne 73 de C:\www\drupal10\web\core\modules\options\options.module).

Steps to reproduce

Create field options list and check on default value

🐛 Bug report
Status

Active

Version

4.1

Component

Code

Created by

🇫🇷France lazzyvn paris

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

Merge Requests

Comments & Activities

  • Issue created by @lazzyvn
  • 🇮🇳India sourav_paul Kolkata

    I've tested it on drupal 10.3 with module version 4.1 this is working as expected even with default value of select list.

    Attaching ss...

    Please provide proper issue reproducing steps..

  • Assigned to sourav_paul
  • First commit to issue fork.
  • 🇺🇸United States ikphilip Charlotte, NC, USA

    I found this error except using module select_or_other 4.2.0 and Drupal 10.4.1.

    Steps to Reproduce

    1. Install Drupal 10.4.1
    2. Install select_or_other 4.2.0 (or dev-4.x)
    3. Enable select_or_other
    4. Create a new field (configurable entity like Node or Content Block).
    5. Selection List field, List (text)
    6. Create at lest 2 allowed values.
    7. Check "Set Default Value" and choose one of the created allowed values.
    8. Save settings. Error should occur.

    Proposed Resolution

    Adjust the code in AllowedValuesConstraintValidator::validate() to more closely match the way it's done in Core.

    See Merge Request.

  • Pipeline finished with Failed
    16 days ago
    Total: 157s
    #416229
  • 🇺🇸United States ikphilip Charlotte, NC, USA
Production build 0.71.5 2024