summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYves Chedemois2007-03-16 16:22:52 (GMT)
committer Yves Chedemois2007-03-16 16:22:52 (GMT)
commit36d4fb5ab497365f4e5a4ff35d6280835d05d9a9 (patch)
tree4e95a383be74882c4ca8ea1ae7f45e7a6798e87e
parent292ad80534e52a588fdb185433cb9c07d519525c (diff)
#116775 - stupid conflict on field form when field_name == 'name' :-) - Thanks BioALIEN,
jimyhuang, sentinelcz
-rw-r--r--content_admin.inc15
1 files changed, 7 insertions, 8 deletions
diff --git a/content_admin.inc b/content_admin.inc
index af6f42e..aafdf9f 100644
--- a/content_admin.inc
+++ b/content_admin.inc
@@ -940,7 +940,8 @@ function _content_admin_field($type_name, $field_name) {
// TODO : generate a series of textfields ?
// why would a widget not have a hook_widget implementation ?
}
- $form['widget']['default_value_fieldset'] = array_merge($form['widget']['default_value_fieldset'], $form_element);
+ $form['widget']['default_value_fieldset']['default_value_widget'] = $form_element;
+ $form['widget']['default_value_fieldset']['default_value_widget']['#tree'] = TRUE;
$form['widget']['default_value_fieldset']['advanced_options'] = array(
'#type' => 'fieldset',
'#title' => t('Php code'),
@@ -1024,13 +1025,13 @@ function _content_admin_field_validate($form_id, $form_values) {
module_invoke($widget_type['module'], 'widget_settings', 'validate', array_merge($field, $form_values));
module_invoke($field_type['module'], 'field_settings', 'validate', array_merge($field, $form_values));
- // If the content module is handling the default value,
+ // If content.module is handling the default value,
// validate the result using the field validation.
if (content_handle('widget', 'default value', $field) == CONTENT_CALLBACK_DEFAULT) {
if (isset($form_values['default_value_php']) && ($php = trim($form_values['default_value_php']))) {
ob_start();
$return = eval($php);
- ob_get_clean();
+ ob_end_clean();
if (!is_array($return)) {
$error = TRUE;
}
@@ -1060,7 +1061,7 @@ function _content_admin_field_validate($form_id, $form_values) {
}
}
else {
- $default_value = $form_values[$field['field_name']];
+ $default_value = $form_values['default_value_widget'][$field['field_name']];
$is_code = FALSE;
form_set_value(array('#parents' => array('default_value_php')), '');
form_set_value(array('#parents' => array('default_value')), $default_value);
@@ -1097,7 +1098,6 @@ function _content_admin_field_validate($form_id, $form_values) {
}
}
-
/**
* Save a field's settings after editing.
*/
@@ -1109,8 +1109,8 @@ function _content_admin_field_submit($form_id, $form_values) {
$widget_types = _content_widget_types();
$widget_type = $widget_types[$form_values['widget_type']];
- // If the content module is handling the default value,
- // Initialize $widget_settings with default values,
+ // If content.module is handling the default value,
+ // initialize $widget_settings with default values,
if (content_handle('widget', 'default value', $field) == CONTENT_CALLBACK_DEFAULT) {
$widget_settings = array(
'default_value' => $form_values['default_value'],
@@ -1124,7 +1124,6 @@ function _content_admin_field_submit($form_id, $form_values) {
$widget_settings[$setting] = $form_values[$setting];
}
}
-
$field_settings = array();
$setting_names = module_invoke($field_type['module'], 'field_settings', 'save', $field);
if (is_array($setting_names)) {