Media Types
Last updated on
30 April 2025
Media types is a bundle for media entities.
You can add a new media type via the media_type_save() function.
$type = new StdClass();
$type->name = 'mymediatype';
$type->label = 'My Media Type';
$type->base = TRUE; // @todo what?
$type->type_callback_args = array(
'match_type' => 'all', // @todo what?
'mimetypes' => array(), // An array of regex patterns e.g. /^audio/
'extensions' => array(), // An array of extensions
'streams' => array() // An array of streams @todo what?
);
$type = media_type_save($type);
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion