in Web & Tech

Drupal: Packaging Content Types with Features while keeping Field Groups intact

Disclaimer: I have no idea why this works, but at least it does.

It seems like a good idea to package complex Drupal content types into reusable packages using the great features module. One fundamental part of content types are field groups. While field groups seem to be detected nicely as dependencies when creating a feature they just seem to never appear when dropping the feature into another site.

After digging around the forums I found out that adding the following code inside the function myfeature_ctools_plugin_api() (located inside myfeature.features.inc) did the trick:

if ($module == 'field_group' && $api == 'field_group') {
    return array('version' => 1);
}

So the implementation of hook_ctools_plugin_api currently looks like this (due to using display suite and responsive images and styles):

/**
 * Implements hook_ctools_plugin_api().
 */
function myfeature_ctools_plugin_api() {
  list($module, $api) = func_get_args();
  if ($module == "ds" && $api == "ds") {
    return array("version" => "1");
  }
  list($module, $api) = func_get_args();
  if ($module == "resp_img" && $api == "default_resp_img_suffixs") {
    return array("version" => "1");
  }
  if ($module == 'field_group' && $api == 'field_group') {
    return array('version' => 1);
  }    
}

Here’s the issue where I got this from and where – hopefully – things will get resolved: http://drupal.org/node/1619154

Write a Comment

Comment