Skip to content
Snippets Groups Projects

Adding default value validation on NumberWidget

1 unresolved thread

Closes #2907520

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
75 76 '#placeholder' => $this->getSetting('placeholder'),
76 77 ];
77 78
79 $buildInfo = $form_state->getBuildInfo();
80 if (!empty($buildInfo["form_id"]) && $buildInfo["form_id"] === 'field_config_form') {
81 $element['#element_validate'] = [[static::class, 'validateDefaultValue']];
  • I'm not sure we should be solving this with an additional element validate. This should be already handled by the constraints set by \Drupal\Core\Field\Plugin\Field\FieldType\NumericItemBase::getConstraints, so isn't there something wrong if the constraints aren't applied against the default value?

  • Please register or sign in to reply
  • Please register or sign in to reply
    Loading