You are here

function units_field_display_mathematical_expression in Units of Measurement 7.2

Fetch expected output format from the provided display.

Parameters

array $display: Display whose expected output format should be fetched

Return value

UnitsMathematicalExpressionWrapper Expected output format from the provided display in the form of mathematical expression object. If none is defined in the provided display, NULL is returned

2 calls to units_field_display_mathematical_expression()
units_field_field_formatter_settings_summary in units_field/units_field.module
Implements hook_field_formatter_settings_summary().
units_field_field_formatter_view in units_field/units_field.module
Implements hook_field_formatter_view().

File

units_field/units_field.module, line 339
Provide field type for storing measured values.

Code

function units_field_display_mathematical_expression($display) {

  // We replace all constants with 1, to make sure quantity can be distributed
  // properly.
  $expression_postfix = $display['settings']['expression_postfix'];
  $expression_postfix = preg_replace('#\\b\\d+\\b#', 1, $expression_postfix);
  return units_mathematical_expression_create_from_postfix($expression_postfix);
}