I'm trying to add a custom node type in hook_install() for my custom module. I've been able to add the fields I want but can't seem to find a way to set the allowed file extensions for file fields. (it defaults to .txt)
The example below shows how I create my file field. I have tried setting both allowed_file_extensions
and file_extensions
in the settings array but that does not seem to work.
How would I set the allowed file extensions for a file field?
field_create_field(array(
'field_name' => 'xxx_video',
'type' => 'file',
'settings' => array('allowed_file_extensions' => array('mp4', 'avi', 'mov', 'wmv', '3gp', 'mpeg', 'mpeg2', 'mkv')),
'entity_type' => array('node'),
));
field_create_instance(array(
'field_name' => 'xxx_video',
'required' => true,
'entity_type' => 'node',
'bundle' => 'xxx',
'label' => t('Video'),
'description' => t('Video to play in smartbox.'),
));