You are here

function _url_fix_field_default_value in URL field 7

Helper function to fix incorrect default values of URL field instances.

See also

http://drupal.org/node/1899498

1 call to _url_fix_field_default_value()
url_update_7100 in ./url.install
Fix incorrect default values of URL field instances.

File

./url.install, line 48

Code

function _url_fix_field_default_value($field, &$instance) {
  if (!empty($instance['default_value'])) {
    $items = $instance['default_value'];
    url_field_presave(NULL, NULL, $field, $instance, LANGUAGE_NONE, $items);
    if ($items !== $instance['default_value']) {
      $instance['default_value'] = $items;
      field_update_instance($instance);
      return TRUE;
    }
  }
  return FALSE;
}