function units_field_field_widget_form in Units of Measurement 7.2
Implements hook_field_widget_form().
File
- units_field/
units_field.module, line 207 - Provide field type for storing measured values.
Code
function units_field_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
switch ($instance['widget']['type']) {
case 'units_value_expression':
$element['expression'] = array(
'#type' => 'units_mathematical_expression',
'#title' => $instance['label'],
'#required' => $element['#required'],
'#value_format' => 'object',
'#default_value' => isset($items[$delta]['expression']) ? $items[$delta]['expression'] : NULL,
'#allowed_dimension' => units_field_dimension($field),
);
break;
}
return $element;
}