Skip to content
Snippets Groups Projects
Commit 98529b93 authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

#104352 by pwolanin. Dissallow the type name '0' which confuses Drupal.

parent b1c11d26
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -237,6 +237,10 @@ function node_type_form_validate($form_id, $form_values) { ...@@ -237,6 +237,10 @@ function node_type_form_validate($form_id, $form_values) {
if (!preg_match('!^[a-z0-9_]+$!', $type->type)) { if (!preg_match('!^[a-z0-9_]+$!', $type->type)) {
form_set_error('type', t('The machine-readable name can only consist of lowercase letters, underscores, and numbers.')); form_set_error('type', t('The machine-readable name can only consist of lowercase letters, underscores, and numbers.'));
} }
// The type cannot be just the character '0', since elsewhere we check it using empty().
if ($type->type === '0') {
form_set_error('type', t("Invalid type. Please enter a type name other than '0' (the character zero)."));
}
} }
$names = array_flip($types); $names = array_flip($types);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment