You are here

function _range_update_instance_7001 in Range 7

Instance update callback for 7001 update.

Parameters

array $instance: Field instance.

Return value

bool Whether given instance was updated or not.

1 string reference to '_range_update_instance_7001'
range_update_7001 in ./range.install
Updates range field instances' settings.

File

./range.install, line 86
Install, update and uninstall functions for the range field module.

Code

function _range_update_instance_7001(array &$instance) {
  if ($instance['widget']['type'] == 'range') {
    if (!empty($instance['settings']['prefix'])) {
      $instance['settings']['from']['prefix'] = $instance['settings']['prefix'];
    }
    if (!empty($instance['settings']['suffix'])) {
      $instance['settings']['to']['suffix'] = $instance['settings']['suffix'];
    }
    unset($instance['settings']['prefix'], $instance['settings']['suffix']);
    foreach (element_children($instance['display']) as $view_mode) {
      $e =& $instance['display'][$view_mode]['settings'];
      $e['from_prefix_suffix'] = $e['to_prefix_suffix'] = $e['prefix_suffix'];
      unset($e['prefix_suffix']);
    }
    return TRUE;
  }
}