You are here

function social_event_type_uninstall in Open Social 8.4

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  2. 8 modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  3. 8.2 modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  4. 8.3 modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  5. 8.5 modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  6. 8.6 modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  7. 8.7 modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  8. 8.8 modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  9. 10.3.x modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  10. 10.0.x modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  11. 10.1.x modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()
  12. 10.2.x modules/social_features/social_event/modules/social_event_type/social_event_type.install \social_event_type_uninstall()

Implements hook_uninstall().

Perform actions related to the de-installation of social_event_type.

File

modules/social_features/social_event/modules/social_event_type/social_event_type.install, line 39
Install, update and uninstall functions for the social_event_type module.

Code

function social_event_type_uninstall() {

  // Fetch sitemananger role.
  $role = Role::load('sitemanager');

  // Set permission for site manager.
  if ($role instanceof Role) {

    // Set permission.
    $role
      ->revokePermission('set social event type settings');
    $role
      ->revokePermission('edit terms in event_types');
    $role
      ->revokePermission('delete terms in event_types');
    $role
      ->trustData()
      ->save();
  }

  // Also remove the fields and the vocabulary.
  \Drupal::configFactory()
    ->getEditable('field.field.node.event.field_event_type')
    ->delete();
  \Drupal::configFactory()
    ->getEditable('field.storage.node.field_event_type')
    ->delete();
  \Drupal::configFactory()
    ->getEditable('taxonomy.vocabulary.event_types')
    ->delete();
  \Drupal::configFactory()
    ->getEditable('social_event_type.settings')
    ->delete();
}