You are here

function redirect_update_8104 in Redirect 8

Save the bulk delete action to config.

File

./redirect.install, line 161
Update hooks for the Redirect module.

Code

function redirect_update_8104() {
  if (!Action::load('redirect_delete_action')) {
    $entity_type_manager = \Drupal::entityTypeManager();
    $module_handler = \Drupal::moduleHandler();

    // Save the bulk delete action to config.
    $config_install_path = $module_handler
      ->getModule('redirect')
      ->getPath() . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
    $storage = new FileStorage($config_install_path);
    $entity_type_manager
      ->getStorage('action')
      ->create($storage
      ->read('system.action.redirect_delete_action'))
      ->trustData()
      ->save();
  }
}