以编程方式删除field_group [英] Delete field_group programmatically

查看:101
本文介绍了以编程方式删除field_group的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



我已经尝试阅读代码,它似乎使用ctools,但是我宁愿不使用ctools。

解决方案

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);
}

只需grep for field_group模块中的这些功能以获取更多信息。 >

I have a field_group called "group_imagecache" in Drupal 7. How would I delete this programmatically?

I have tried reading the code and it seems it uses ctools, but I would rather not use ctools.

解决方案

ctools is a dependency of field_group. If you want to interact with field groups programmatically, you'll need to do so through ctools' API.

Fortunately, it isn't hard in this case. Something like the following should work:

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

Just grep for those functions in the field_group module for more information.

这篇关于以编程方式删除field_group的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆