Problem/Motivation
I tried to use this module with panels (panelizer) and the file entity module (file displays) and came across some issues:
- I wasn't able to use the
rendered fileformatter. - The image formatter, configured in panels, wasn't handled properly.
- Images placed by media in the wysiwyg editor aren't responsive.
Proposed resolution
- Use
hook_file_view_alter()to adjust the theming of the fields handled by file entity. - In
resp_img_field_attach_view_alter()we should use the display settings from$contextif$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. - 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
Comment #1
das-peter commentedSlightly more defensive code in
resp_img_file_view_alter().Comment #2
das-peter commentedUpdated 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.Comment #2.0
das-peter commentedAdded text filter issue.
Comment #3
attiks commentedOld issue, I think you better update to the picture module