Skip to content

Instantly share code, notes, and snippets.

@pfaocle
Created June 3, 2013 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfaocle/5701686 to your computer and use it in GitHub Desktop.
Save pfaocle/5701686 to your computer and use it in GitHub Desktop.
Save File Entity file display settings in code - uses CTools exportables.
<?php
// We assume that a custom module is implementing a file formatter
// called 'mymodule_custom_file_formatter'.
$filetype = 'video'; // File type to alter file display for.
$display = 'preview'; // File display to alter - 'default', 'teaser' or 'preview'.
$video_display = file_display_new($filetype, $display, 'mymodule_custom_file_formatter');
$video_display->export_type = 1;
$video_display->table = 'file_display';
$video_display->type = 'Normal';
$video_display->status = 1;
file_display_save($video_display);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment