Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete field_group programmatically

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.

like image 872
Chris Muench Avatar asked Oct 19 '11 18:10

Chris Muench


1 Answers

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.

like image 185
theunraveler Avatar answered Oct 03 '22 10:10

theunraveler