diff --git a/select_or_other.field_widget.inc b/select_or_other.field_widget.inc index d8a9ca2..348bc17 100644 --- a/select_or_other.field_widget.inc +++ b/select_or_other.field_widget.inc @@ -365,21 +365,21 @@ function select_or_other_field_widget_settings_form($field, $instance) { } /** - * Implements hook_field_update_instance(). - * - * Make allowed values, other, and other + * Implements hook_field_create_instance(). */ -function select_or_other_field_update_instance($instance, $prior_instance) { - $settings = $instance['widget']['settings']; - - if (empty($settings['available_options']) && empty($settings['available_options_php'])) { +function select_or_other_field_create_instance($instance) { + if ( + empty($instance['widget']['settings']['available_options']) && + empty($instance['widget']['settings']['available_options_php']) + ) { return; } + $settings = $instance['widget']['settings']; $options = array_map('trim', explode("\n", $settings['available_options'])); $tkey = 'select_or_other:' . $instance['field_name']; - foreach($options as $option) { + foreach ($options as $option) { $option = filter_xss($option); if (strpos($option, '|') !== FALSE && empty($settings['available_options_php'])) { @@ -398,6 +398,15 @@ function select_or_other_field_update_instance($instance, $prior_instance) { } /** + * Implements hook_field_update_instance(). + * + * Make allowed values, other, and other + */ +function select_or_other_field_update_instance($instance, $prior_instance) { + select_or_other_field_create_instance($instance); +} + +/** * Transforms submitted form values into field storage format. * Align with Drupal core select list, NULL (-None-) value. * http://drupal.org/node/1830090