You are here

function cdn_update_8001 in CDN 8.3

Update the default settings if they are not modified by the user.

File

./cdn.install, line 11
Update functions for the CDN module.

Code

function cdn_update_8001() {
  $cdn_settings = \Drupal::configFactory()
    ->getEditable('cdn.settings');
  $mapping = $cdn_settings
    ->get('mapping');
  if ($mapping['type'] === 'simple' && $mapping['conditions'] === []) {
    $cdn_settings
      ->set('mapping.conditions', [
      'not' => [
        'extensions' => [
          'css',
          'js',
        ],
      ],
    ]);
    $cdn_settings
      ->save();
  }
}