- 🇫🇷France Dom.
Outdated: fixed in #3158162: Refactor JS to allow masonry after AJAX → .
Feel free to re-open if needed though.
While working on a site, I've noticed that the required JS for Masonry isn't being loaded via XHR requests. It appears fine in Views UI but when used on an actual page it's not coming through XHR requests as it does through the admin interface.
A temporary fix for now has been adding it via the theme's template.php:
function hook_views_pre_render(&$view) {
if ($view->name == '<view name>' && $view->current_display == '<view display>') {
// load the libraries
drupal_add_js(libraries_get_path('masonry') . '/masonry.pkgd.min.js');
drupal_add_js(libraries_get_path('imagesloaded') . '/imagesloaded.pkgd.min.js');
drupal_add_css(drupal_get_path('module', 'masonry') . '/masonry.js');
// copy paste from template_preprocess_views_view_masonry() in masonry_views.module.
// Display content in a Masonry layout
$container = '.view-' . drupal_clean_css_identifier($view->name) . '.view-display-id-' . $view->current_display . ' > .view-content';
if (!empty($options['grouping'])) {
$vars['grouping'] = true;
static $groupid;
$container .= ' .masonry-group-' . ++$groupid;
$vars['prefix'] = "<div class=\"masonry-group masonry-group-$groupid\">";
$vars['suffix'] = "</div>";
}
$options['masonry_item_selector'] = '.masonry-item';
masonry_apply($container, $options);
}
}
Closed: outdated
3.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Outdated: fixed in
#3158162: Refactor JS to allow masonry after AJAX →
.
Feel free to re-open if needed though.