You are here

function high_contrast_update_8003 in High contrast 8

Remove database entry for the high_contrast.css file.

File

./high_contrast.install, line 43
Contains install and update functions for High Contrast.

Code

function high_contrast_update_8003() {
  $database = \Drupal::database();
  $query = $database
    ->query('SELECT fid FROM {file_managed} where uri=:uri', [
    ':uri' => HIGH_CONTRAST_CSS_LOCATION,
  ]);
  $result = $query
    ->fetchAll();
  foreach ($result as $record) {
    $file = File::load($record->fid);
    $file
      ->delete();
  }

  // Re-add the CSS file by saving configuration.
  \Drupal::configFactory()
    ->getEditable('high_contrast.settings')
    ->save();
}