以编程方式删除field_group

Chr*_*nch 6 drupal drupal-7

我在Drupal 7中有一个名为"group_imagecache"的field_group.如何以编程方式删除它?

我试过阅读代码,它似乎使用ctools,但我宁愿不使用ctools.

the*_*ler 7

ctools是field_group的依赖项.如果您想以编程方式与字段组进行交互,则需要通过ctools的API进行操作.

幸运的是,在这种情况下并不难.像下面这样的东西应该工作:

if ($group = field_group_load_field_group($group_name, $entity_type, $bundle_name, $mode)) {
  ctools_include('export');
  field_group_group_export_delete($group, FALSE);
}
Run Code Online (Sandbox Code Playgroud)

只需在field_group模块中grep这些函数以获取更多信息.