You are here

function field_group_group_delete in Field Group 8

Delete a field group.

Parameters

$group: A group definition.

1 call to field_group_group_delete()
FieldGroupDeleteForm::submitForm in src/Form/FieldGroupDeleteForm.php
Form submission handler.

File

./field_group.module, line 635
Allows administrators to attach custom fields to fieldable types.

Code

function field_group_group_delete($group) {
  if ($group->context == 'form') {
    $display = EntityFormDisplay::load($group->entity_type . '.' . $group->bundle . '.' . $group->mode);
  }
  elseif ($group->context == 'view') {
    $display = EntityViewDisplay::load($group->entity_type . '.' . $group->bundle . '.' . $group->mode);
  }

  /**
   * @var $display \Drupal\Core\Entity\Display\EntityDisplayInterface
   */
  if (isset($display)) {
    $display
      ->unsetThirdPartySetting('field_group', $group->group_name);
    $display
      ->save();
  }
  Drupal::moduleHandler()
    ->invokeAll('field_group_delete_field_group', array(
    $group,
  ));
}