Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This can be made compatible with Media and Media Gallery with a simple addition to masonry_formatter_field_types().
/**
* Get a list of supported field types and their formatters.
*
* @return
* An associative array where the keys are field types and the values are
* arrays of formatter type names.
*/
function masonry_formatter_field_types() {
return array(
'image' => array(
'colorbox',
'image',
),
'text_long' => array(
'text_default',
'text_plain',
'text_trimmed',
),
'text_with_summary' => array(
'text_default',
'text_plain',
'text_summary_or_trimmed',
'text_trimmed',
),
'media' => array(
'media',
'media_gallery',
),
);
}
You'll also need to make some CSS modifications to override Media Gallery's attempts to organize field items in to columns and rows. An example of my set up:
#zone-content .node-media-gallery .field-name-media-gallery-media .field-item {
margin: 0; }
#zone-content .node-media-gallery .field-name-media-gallery-media .field-item.masonry-brick {
width: 230px !important; }
Settings at admin/structure/types/manage/media-gallery/display/full
File view mode: Gallery thumbnail
Masonry: Enabled
Column width: 230 px
Animations: Enabled
Duration: 500 ms
Resizable: Yes
Center grid: Yes
Gutter width: 0 px
RTL layout: No
Voila! Looks great.
Comments
Comment #1
BWPanda CreditAttribution: BWPanda commentedCommitted: http://drupalcode.org/project/masonry.git/commit/053e5c6
I only added support for Media Gallery as the 'Media' formatter seems to be deprecated (http://drupalcode.org/project/media.git/blob/refs/heads/7.x-1.x:/include...).
Also, I couldn't find a way to override Media's CSS, so anyone using this feature of Masonry will have to do that themselves as described above.
Comment #2.0
(not verified) CreditAttribution: commentedtypo