Problem/Motivation

I tried to use this module with panels (panelizer) and the file entity module (file displays) and came across some issues:

  1. I wasn't able to use the rendered file formatter.
  2. The image formatter, configured in panels, wasn't handled properly.
  3. Images placed by media in the wysiwyg editor aren't responsive.

Proposed resolution

  1. Use hook_file_view_alter() to adjust the theming of the fields handled by file entity.
  2. In resp_img_field_attach_view_alter() we should use the display settings from $context if $context['view_mode'] is _custom. I've to check this in detail, but I think this could also work as a replacement for the current views handling.
  3. Provide a text filter to convert images to responsive images. If this filter runs after the media filter, it also works with the media module.

The first attached patch does the necessary changes.
Further it adds module_load_include('module', 'breakpoints'); to resp_img_entity_info_alter() as I had cases in which breakpoints_breakpoint_group_load_all() wasn't available.

The second attached patch is does simply some cleanup to comply with the coding standards. It adds some documentation too, but I'm not 100% sure that everything is absolutely correct ;)

Remaining tasks

Needs review.

User interface changes

none

API changes

none

Comments

das-peter’s picture

Slightly more defensive code in resp_img_file_view_alter().

das-peter’s picture

Title: Add file entity view mode support. » Add file entity file display mode support and text filter
StatusFileSize
new8.09 KB
new10.29 KB

Updated summary to add the point about the text filter.

I've decided to simply add this feature to this patch. If necessary I'll create a spin-off.

The text filter uses a two step approach to keep the text filter itself cacheable.
Since the filtering of text only happens if the text is changed we can't rely on the text filter itself to add the necessary javascripts. Thus resp_img_field_attach_view_alter() takes care of adding the javascript if the the resp img text filter is enabled.

das-peter’s picture

Issue summary: View changes

Added text filter issue.

attiks’s picture

Status: Needs review » Closed (fixed)

Old issue, I think you better update to the picture module