diff --git a/core/modules/node/content_types.inc b/core/modules/node/content_types.inc index 8927940..041ffd0 100644 --- a/core/modules/node/content_types.inc +++ b/core/modules/node/content_types.inc @@ -128,7 +128,8 @@ function node_type_form($form, &$form_state, $type = NULL) { $form['type'] = array( '#type' => 'machine_name', '#field_prefix' => 'custom_', - '#default_value' => $type->type, + // Remove the 'custom_' prefix from the default value. + '#default_value' => preg_replace('/^custom_/', '', $type->type), // 32 characters minus the 'custom_' prefix. '#maxlength' => 25, '#disabled' => $type->locked, @@ -308,12 +309,8 @@ function _node_characters($length) { */ function node_type_form_validate($form, &$form_state) { $type = new stdClass(); - $type->type = trim($form_state['values']['type']); - // If this is a new type, append 'custom_' to the name. - if (empty($form_state['values']['old_type'])) { - $type->type = 'custom_' . $type->type; - form_set_value($form['type'], $type->type, $form_state); - } + $type->type = 'custom_' . trim($form_state['values']['type']); + form_set_value($form['type'], $type->type, $form_state); $type->name = trim($form_state['values']['name']); // Work out what the type was before the user submitted this form