summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYves Chedemois2008-09-18 23:36:41 (GMT)
committer Yves Chedemois2008-09-18 23:36:41 (GMT)
commit36c7314bd496537e5d1c91ec7c90c2f031e00092 (patch)
tree027919e2ad633959f0c201b4f66d8b01134136b1
parent0fb1854a6ebc24a2e14a990094766021c052a278 (diff)
#310414 Fix broken redirects when adding fields to content types with an underscore in their machine names.
-rw-r--r--CHANGELOG.txt1
-rw-r--r--includes/content.admin.inc17
2 files changed, 11 insertions, 7 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index f5bcc0b..f77adf3 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -24,6 +24,7 @@ Be sure to visit update.php after uploading this release.
- #309365 by jhuckabee - Views integration: Consider relationships when force-adding the 'Node: Type' field.
- #308215 by Reg - Nodereference: Do not filter on empty string when querying for referenceable nodes.
- #308778 Fix $item['view'] element missing for tokens and contemplate.
+- #310414 Fix broken redirects when adding fields to content types with an underscore in their machine names.
CCK 6.2-rc7
===========
diff --git a/includes/content.admin.inc b/includes/content.admin.inc
index 6f60a88..7035b27 100644
--- a/includes/content.admin.inc
+++ b/includes/content.admin.inc
@@ -423,13 +423,16 @@ function _content_field_overview_form_validate_add_existing($form, &$form_state)
function content_field_overview_form_submit($form, &$form_state) {
$form_values = $form_state['values'];
+ $type_name = $form['#type_name'];
+ $type = content_types($type_name);
+
// Update field weights.
$extra = array();
foreach ($form_values as $key => $values) {
// Groups are handled in fieldgroup_content_overview_form_submit().
if (in_array($key, $form['#fields'])) {
db_query("UPDATE {". content_instance_tablename() ."} SET weight = %d WHERE type_name = '%s' AND field_name = '%s'",
- $values['weight'], $form['#type_name'], $key);
+ $values['weight'], $type_name, $key);
}
elseif (in_array($key, $form['#extra'])) {
$extra[$key] = $values['weight'];
@@ -437,10 +440,10 @@ function content_field_overview_form_submit($form, &$form_state) {
}
if ($extra) {
- variable_set('content_extra_weights_'. $form['#type_name'], $extra);
+ variable_set('content_extra_weights_'. $type_name, $extra);
}
else {
- variable_del('content_extra_weights_'. $form['#type_name']);
+ variable_del('content_extra_weights_'. $type_name);
}
content_clear_type_cache();
@@ -450,13 +453,13 @@ function content_field_overview_form_submit($form, &$form_state) {
// Create new field.
if (!empty($form_values['_add_new_field']['field_name'])) {
$field = $form_values['_add_new_field'];
- $field['type_name'] = $form['#type_name'];
+ $field['type_name'] = $type_name;
module_load_include('inc', 'content', 'includes/content.crud');
if (content_field_instance_create($field)) {
// Store new field information for fieldgroup submit handler.
$form_state['fields_added']['_add_new_field'] = $field['field_name'];
- $destinations[] = 'admin/content/node-type/'. $field['type_name'] .'/fields/'. $field['field_name'];
+ $destinations[] = 'admin/content/node-type/'. $type['url_str'] .'/fields/'. $field['field_name'];
}
else {
drupal_set_message(t('There was a problem creating field %label.', array(
@@ -467,7 +470,7 @@ function content_field_overview_form_submit($form, &$form_state) {
// Add existing field.
if (!empty($form_values['_add_existing_field']['field_name'])) {
$field = $form_values['_add_existing_field'];
- $field['type_name'] = $form['#type_name'];
+ $field['type_name'] = $type_name;
$existing_field = content_fields($field['field_name']);
if ($existing_field['locked']) {
@@ -478,7 +481,7 @@ function content_field_overview_form_submit($form, &$form_state) {
if (content_field_instance_create($field)) {
// Store new field information for fieldgroup submit handler.
$form_state['fields_added']['_add_existing_field'] = $field['field_name'];
- $destinations[] = 'admin/content/node-type/'. $field['type_name'] .'/fields/'. $field['field_name'];
+ $destinations[] = 'admin/content/node-type/'. $type['url_str'] .'/fields/'. $field['field_name'];
}
else {
drupal_set_message(t('There was a problem adding field %label.', array('%label' => $field['field_name'])));