I' having some issues getting this to work on some of my themes. I noticed it works fine within the admin theme (SEven) but not on my main theme Zymphonies. Also tried on bartik, and it works, not on stark. I'm thinking this is a bootstrap issue. And I followed this comment, https://www.drupal.org/node/2620994 and although the items show up in a grid, The masonry effect does not seem to work. It just looks like a grid. I"m noting the views div classes are different on themes it works on:

Working: "contextual-region view view-masonry view-id-masonry view-display-id-page_1 js-view-dom-id-xxxxxxxxxxxxxxxxx"
Not working: "contextual-region js-view-dom-id-xxxxxxxxxxxxxxxxxx"

hoping for some helpful insights...

Members fund testing for the Drupal project. Drupal Association Learn more


butteryak created an issue. See original summary.

butteryak’s picture

So as far as I can tell, the container cannot be built as the div cannot be targeted by the masonry script.

As an experiment I hacked the module to change this:

// Build the view container
  $container = '.view-' . Html::cleanCssIdentifier($view->storage->id()) . '.view-display-id-' . $view->current_display . ' > .view-content';

To this:
// Build the view container
$container = 'mscontainer';

And then in the views advanced settings I set the views class to "mscontainer"
Voila! that works.

still getting my feet wet with drupal 8, perhaps I'm missing something, but why is the view class created differently for some themes?

butteryak’s picture

Issue summary: View changes
Dom.’s picture

I guess if the view template file is overriden from the theme and if it removes the default classes, then it would break indeed. I don't know what can I do against it for moment...

butteryak’s picture

well, for now my "hack" works. perhaps it might make sense to include an option to declare your own css class for the div that the jquery attaches to. or even just hard code it as a specific class, and then as part of the module setup, just declare the view class. perhaps.

Dom.’s picture

Status: Active » Needs review
1.68 KB

Could you eventually have a try at this patch ? Does it solves your issue ?

  • Dom. committed e3d3e1c on 8.x-1.x
    Issue #2716399 by Dom.: Not working on some 8 themes
Dom.’s picture

Status: Needs review » Fixed

Committed on dev

Dom.’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Dom.’s picture

Status: Closed (fixed) » Needs work

This patch prevents "infinite views scroll" integration. reverted.