function domain_menu_access_uninstall in Domain Menu Access 8
Same name and namespace in other branches
- 6 domain_menu_access.install \domain_menu_access_uninstall()
- 7 domain_menu_access.install \domain_menu_access_uninstall()
Implements hook_uninstall().
Removes access control fields on uninstall.
File
- ./
domain_menu_access.install, line 43 - Install, update and uninstall functions for the Domain Menu Access module.
Code
function domain_menu_access_uninstall() {
$entity_type = $bundle = 'menu_link_content';
/** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $storage */
$entity_form_display_storage = \Drupal::entityTypeManager()
->getStorage('entity_form_display');
if ($display = $entity_form_display_storage
->load($entity_type . '.' . $bundle . '.default')) {
$display
->delete();
}
$field_names = [
$entity_type . '.' . DOMAIN_ACCESS_FIELD,
$entity_type . '.' . DOMAIN_ACCESS_ALL_FIELD,
];
$field_storage_config = \Drupal::entityTypeManager()
->getStorage('field_storage_config');
$fields = $field_storage_config
->loadMultiple($field_names);
if (!empty($fields)) {
$field_storage_config
->delete($fields);
}
}