function commerce_sdf_field_formatter_info in Commerce Stock 7.2
Implements hook_field_formatter_info().
File
- modules/
commerce_sdf/ commerce_sdf.module, line 11 - Provide a Decimal formater for converting stock levels into text messages.
Code
function commerce_sdf_field_formatter_info() {
$settings = array();
// Defaults for in and out of stock.
$settings['display'][0]['seuil'] = 0;
$settings['display'][0]['message'] = t('Out of stock');
$settings['display'][1]['seuil'] = 99999999;
$settings['display'][1]['message'] = t('In stock');
// Add empty values.
for ($i = 2; $i < 5; $i++) {
$settings['display'][$i]['seuil'] = '';
$settings['display'][$i]['message'] = '';
$settings['display'][$i]['classname'] = '';
}
// Return the formatter info.
return array(
'commerce_sdf_formatter' => array(
'label' => t('Show stock display as message'),
'field types' => array(
'number_decimal',
),
'settings' => $settings,
),
);
}