This module doesn't work with field groups. After the entity view is cached, the needed css and js files for field groups won't load.

I've tested it with horizontal tabs and accordion field group types. (Tested on a clean install, on simplytest.me)

I would greatly appreciate it if you could solve this problem, since this is otherwise a great module.

I'll also give some effort to find out the reason and solve it but I have already spent a whole work-day for that, and I'm not sure if my employer would like to invest some more man-hours for this issue :(

Comments

ey’s picture

I have found a workaround for that:

/**
 * Implements hook_node_view().
 */
function MYMODULE_node_view($node, $view_mode, $langcode) {
  if ($view_mode == 'full' && $node->type == 'MY_CONTENT_TYPE') {
    // Workaround for Display Cache not caching Field Group libraries
    // Here add the needed library, in my case I needed the 'horizontal-tabs',
    // for other field group types, the name of the library is different.
    $node->content['#attached']['library'][] = array('field_group', 'horizontal-tabs');
  }
}
kars-t’s picture

Status: Active » Closed (works as designed)

Hi

this is sadly a common problem with contrib modules but not one of display cache even if display cache makes it obvious that it is a bad idea to use drupal_add_something() in for example the field layer.

The #attached version should be used more commonly and this solves the problem as anything that is attached is attached to the cache as well. Other methods won't work. Maybe you should change this into an issue for field groups. But as far is it is about display cache this works as intended.