问题描述
我在 Drupal 7 中有一个名为group_imagecache"的 field_group.我如何以编程方式删除它?
I have a field_group called "group_imagecache" in Drupal 7. How would I delete this programmatically?
我已经尝试阅读代码,它似乎使用了 ctools,但我宁愿不使用 ctools.
I have tried reading the code and it seems it uses ctools, but I would rather not use ctools.
推荐答案
ctools 是 field_group 的依赖项.如果您想以编程方式与字段组进行交互,则需要通过 ctools 的 API 来实现.
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);
}
只需对 field_group 模块中的那些函数进行 grep 即可获得更多信息.
Just grep for those functions in the field_group module for more information.
这篇关于以编程方式删除 field_group的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!