User login

Media styles workaround (extremely fragmented notes)

Summary of What's Working

<?php
/**
 * Define additional view modes for Media formatting.
 */
function feature_media_configuration_entity_info_alter(&$entity_info) {
  // Based on RobW's code: http://drupal.org/node/1026790#comment-4667062
  // Media module only recognizes view modes with the prefix media_.
 
  // View mode for mobile slideshow images
  $entity_info['file']['view modes']['media_mobile_slideshow'] = array(
    'label' => t('Mobile Slideshow'),
    'custom settings' => TRUE,
  );
}
?>

Background

User generated styles exportable via Features
http://drupal.org/node/1189040

fabsor, this is great.

It adds File Styles and the export works.

Sorry in advance for hijacking this issue a bit... there is one key piece of configuration that doesn't seem to be exported by anything. That is the association of the

UPDATE file_display SET weight='0', status='1', settings='a:1:{s:11:\"image_style\";s:15:\"fixed_height_5x\";}' WHERE (name = 'image__media_continuum__file_image')

We have a pretty annoying bug/feature in Media at the moment, which is that the only way for images to actually show up is [to define a build mode related setting and attach the style to that]

We therefore had to create custom view modes (in code) to have a proper set of ex

The File Entity component is the key for exporting this relationship between build [mode and image style]

ctools_export_load_object

SELECT t__0.* FROM file_display t__0 WHERE (name IN ('image__media_continuum__file_field_styles_file_large', 'image__media_continuum__file_field_styles_file_medium', 'image__media_continuum__file_field_styles_file_original', 'image__media_continuum__file_field_styles_file_square_thumbnail', 'image__media_continuum__file_field_styles_file_thumbnail', 'image__media_continuum__file_field_file_default', 'image__media_continuum__file_image', 'image__media_continuum__file_field_media_large_icon', 'image__media_continuum__file_field_file_rendered', 'image__media_continuum__file_field_file_table', 'image__media_continuum__file_field_file_url_plain', 'image__media_continuum__media_vimeo_image', 'image__media_continuum__media_vimeo_video'))

ctools_export_load_object

SELECT t__0.* FROM file_display t__0 WHERE (name IN ('image__media_continuum__media_vimeo_image', 'image__media_continuum__media_vimeo_video'))

drupal_write_record

UPDATE file_display SET weight='0', status='0', settings='N;' WHERE (name = 'image__media_continuum__file_field_styles_file_large')

and a whole bunch like this:

drupal_write_record

UPDATE file_display SET weight='0', status='1', settings='a:1:{s:11:\"image_style\";s:15:\"fixed_height_5x\"; }' WHERE (name = 'image__media_continuum__file_image')

File Entity
image__media_continuum__file_image image__media_continuum_expanded__file_image image__media_related__file_image image__media_viewbook__file_image

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.