private function CdnProvider::importProviderData in Express 8
Imports data for a provider that was manually uploaded in theme settings.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
1 call to CdnProvider::importProviderData()
- CdnProvider::alterFormElement in themes/
contrib/ bootstrap/ src/ Plugin/ Setting/ Advanced/ Cdn/ CdnProvider.php - The alter method to store the code.
File
- themes/
contrib/ bootstrap/ src/ Plugin/ Setting/ Advanced/ Cdn/ CdnProvider.php, line 189 - Contains \Drupal\bootstrap\Plugin\Setting\Advanced\Cdn\CdnProvider.
Class
- CdnProvider
- The "cdn_provider" theme setting.
Namespace
Drupal\bootstrap\Plugin\Setting\Advanced\CdnCode
private function importProviderData(FormStateInterface $form_state) {
if ($form_state
->getValue('clicked_button') === t('Save provider data')
->render()) {
$provider_path = ProviderManager::FILE_PATH;
file_prepare_directory($provider_path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
$provider = $form_state
->getValue('cdn_provider', $this->theme
->getSetting('cdn_provider'));
$file = "{$provider_path}/{$provider}.json";
if ($import_data = $form_state
->getValue('cdn_provider_import_data', FALSE)) {
file_unmanaged_save_data($import_data, $file, FILE_EXISTS_REPLACE);
}
elseif ($file && file_exists($file)) {
file_unmanaged_delete($file);
}
// Clear the cached definitions so they can get rebuilt.
$this->providerManager
->clearCachedDefinitions();
}
}