function commerce_file_configure_line_item_type in Commerce File 7
Configure a line item type
- add field to product line items
1 call to commerce_file_configure_line_item_type()
- commerce_file_configure_line_item_fields in ./
commerce_file.module - Configures line item types defined by other modules that are enabled after the Commerce File module.
File
- ./
commerce_file.module, line 1114 - Provides integration of file licenses with Commerce
Code
function commerce_file_configure_line_item_type($line_item_type) {
if (!empty($line_item_type['product'])) {
$entity_type = 'commerce_line_item';
// add line item file field
$field_name = _commerce_file_get_field_names('line_item_files');
_commerce_file_create_instance(COMMERCE_FILE_FIELD_TYPE, $field_name, $entity_type, $line_item_type['type'], array(
'field' => array(
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'locked' => TRUE,
'settings' => array(
'uri_scheme' => _commerce_file_default_system_scheme(),
),
),
'instance' => array(
'label' => 'Commerce File',
'required' => FALSE,
'settings' => array(
'file_extensions' => 'mp4 m4v flv wmv mp3 wav jpg jpeg png pdf doc docx ppt pptx xls xlsx',
'file_directory' => 'commerce-files',
'max_filesize' => '',
),
'widget' => array(
'type' => 'commerce_file_generic',
'weight' => 20,
),
'display' => array(
'default' => array(
'label' => 'hidden',
),
),
),
));
}
}