function commerce_product_reference_field_widget_info in Commerce Core 7
Implements hook_field_widget_info().
Defines widgets available for use with field types as specified in each widget's $info['field types'] array.
File
- modules/
product_reference/ commerce_product_reference.module, line 921 - Defines a field type for referencing products from other entities.
Code
function commerce_product_reference_field_widget_info() {
$widgets = array();
// Define an autocomplete textfield widget for product referencing that works
// like the Term Reference autocomplete widget.
$widgets['commerce_product_reference_autocomplete'] = array(
'label' => t('Autocomplete text field'),
'description' => t('Display the list of referenceable products as a textfield with autocomplete behaviour.'),
'field types' => array(
'commerce_product_reference',
),
'settings' => array(
'autocomplete_match' => 'contains',
'size' => 60,
'autocomplete_path' => 'commerce_product/autocomplete',
),
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_CUSTOM,
),
);
// Do not show the widget on forms; useful in cases where reference fields
// have a lot of data that is maintained automatically.
$widgets['commerce_product_reference_hidden'] = array(
'label' => t('Do not show a widget'),
'description' => t('Will not display the product reference field on forms. Use only if you maintain product references some other way.'),
'field types' => array(
'commerce_product_reference',
),
'behaviors' => array(
'multiple values' => FIELD_BEHAVIOR_CUSTOM,
),
);
return $widgets;
}