Hey,

can anybody tell me how I can remove all the css field group div classes?

They are builded in field_group.module at line 509:
$group->classes = array('field-group-' . $group->format_type, str_replace('_', '-', $group->group_name));

I think that's to much:
field-group-format group_memory_card field-group-div group-memory-card memory-card speed-fast effect-none

Would be very cool to remove them via the ui.

Yannick

Comments

loominade’s picture

all classes should only be added if desired by opt-in (like everywhere in drupal, but thats another issue #1485678: create less output by default / opt-in classes and wrappers)

yannickoo’s picture

I could find out how to remove all classes except the custom classes:

/**
 * Implements hook_field_group_pre_render().
 */
function MODULENAME_field_group_build_pre_render_alter(&$element) {
  // We store the format type and the custom css classes.
  $format_type = $element['#groups']['group_memory_card']->format_type;
  $css_classes = $element['#groups']['group_memory_card']->format_settings['instance_settings']['classes'];

  // We build an array for the attributes.
  $attributes = ($css_classes) ? array('class' => $css_classes) : array();

  // We rewrite the prefix.
  $element['group_memory_card']['#prefix'] = '<' . $format_type . drupal_attributes($attributes) . '>';
}
Stalski’s picture

Status: Active » Fixed

This is pushed to git, thx for the report.

The fix includes:
- separation of required and optional classes. Required classes are especially for JS to pick in.
- update script to make sure the old and configured extra classes are added into the extra classes.

There are still lots of required classes, especially on the div format type.

yannickoo’s picture

Yeah, thanks!

Status: Fixed » Closed (fixed)

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

dtarc’s picture

Status: Closed (fixed) » Active

How would I get the optional classes to render in the markup?

dtarc’s picture

Status: Active » Closed (fixed)

I figured out what happened & created an issue regarding features support here #2085225: Featurized Field Groups no longer have classes since marked optional.