You are here

function oembed_providers_update_8201 in oEmbed Providers 2.x

Convert 1.x.x allowed providers into "video" bucket.

1 call to oembed_providers_update_8201()
UpdateTest::testUpdate8201 in tests/src/Kernel/UpdateTest.php
Tests oembed_providers_update_8201().

File

./oembed_providers.install, line 24
This module provides install, uninstall, and update functions.

Code

function oembed_providers_update_8201() {
  $config = \Drupal::service('config.factory')
    ->getEditable('oembed_providers.settings');
  $providers = $config
    ->get('allowed_providers');
  $config
    ->clear('allowed_providers');
  $config
    ->save();
  ProviderBucket::create([
    'id' => 'video',
    'label' => 'Remote Video',
    'providers' => $providers,
  ])
    ->save();
  return t('Global "Allowed Providers" were migrated to a newly created "Remote Video (video)" provider bucket.');
}