You are here

function _range_update_instance_7004 in Range 7

Instance update callback for 7004 update.

Parameters

array $instance: Field instance.

Return value

bool Whether given instance was updated or not.

1 string reference to '_range_update_instance_7004'
range_update_7004 in ./range.install
Updates range field formatters' settings.

File

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

Code

function _range_update_instance_7004(array &$instance) {
  $return = FALSE;
  foreach ($instance['display'] as $view_mode => $display) {
    if (in_array($display['type'], array(
      'range_integer',
      'range_decimal',
    ))) {
      $instance['display'][$view_mode]['settings'] += array(
        'number_formatter' => 'number_format',
        'format_string' => $display['type'] === 'range_integer' ? '%d' : '%.2f',
      );
      $return = TRUE;
    }
  }
  return $return;
}