Custom display modes for Drupal's Measured Value Field

No votes yet

Note: This patch has been submited to drupal.org and is part of the module now.

If you need to add custom display modes in Measured Value Field this simple patch can accomplish this.

Open mvf.module and go to

function mvf_widget_settings($op, $widget)

Change

$options_single = mvf_get_display_modes_single();
$options_range = mvf_get_display_modes_range();

to

$options_single = module_invoke_all('get_display_modes_single');
$options_range = module_invoke_all('get_display_modes_range');

Now you can create functions in your modules that can imlepent new display modes

function mymodule_get_display_modes_single() {
  return array(
      'f|s' => t('"From" value + Symbol'),
  );
}
function mymodule_get_display_modes_range() {
  return array(
      't|s|-|f|s' => t('"To" value + Symbol + Space + Hyphen + Space + "From" value + Symbol'),
  );
}

This example swaps From and To values and adds symbol to both numbers

 

glqxz9283 sfy39587stf02 mnesdcuix8
sfy39587stf03
sfy39587stf04