You are here

function field_default_token_number_validate in Field default token 8

Individual number element validation handler for field_ui_field_edit_form.

Replacement for number_field_widget_validate().

1 string reference to 'field_default_token_number_validate'
field_default_token_fix_number_validation in ./field_default_token.module
Removes numeric field validation.

File

./field_default_token.module, line 319
Enables to use tokens as field default values.

Code

function field_default_token_number_validate(&$element, FormStateInterface $form_state, &$complete_form) {
  $value = $element['#value'];
  if (strpos($value, '[') !== FALSE) {

    // Token in default value, do not validate.
    return;
  }
  Number::validateNumber($element, $form_state, $complete_form);
}