You are here

public function PermissionConfigurationHandler::removeFromDatabase in Configuration Management 7.3

Deletes a configuration from the database.

Parameters

\Configuration\Configuration $configuration: The configuration to be deleted.

Overrides ConfigurationHandler::removeFromDatabase

File

src/Handlers/PermissionConfigurationHandler.php, line 111

Class

PermissionConfigurationHandler

Namespace

Configuration\Handlers

Code

public function removeFromDatabase(Configuration $configuration) {

  // Revoke access to all the roles for this permission.
  $event = $this
    ->triggerEvent('remove_from_database', $configuration);
  $permission = $event->configuration
    ->getData();
  $this->configuration_manager
    ->drupal()
    ->permission_deletePermission($permission['permission']);

  // Clear the user access cache.
  $this->configuration_manager
    ->drupal()
    ->drupal_static_reset('user_access');
  $this->configuration_manager
    ->drupal()
    ->drupal_static_reset('user_role_permissions');
}