You are here

function workbench_access_update_8002 in Workbench Access 8

Update to new access scheme config entity.

File

./workbench_access.install, line 21
Install, update and uninstall functions for the Workbench Access module.

Code

function workbench_access_update_8002() {

  // Stash this for later.
  \Drupal::state()
    ->set('workbench_access_original_configuration', \Drupal::config('workbench_access.settings'));

  // Alter it to the new format.
  $config = \Drupal::configFactory()
    ->getEditable('workbench_access.settings');
  foreach ([
    'scheme',
    'label',
    'plural_label',
    'fields',
    'parents',
  ] as $delete) {
    $config
      ->clear($delete);
  }
  $config
    ->save(TRUE);
}