function _thunder_media_update_entity_browser_config in Thunder 8.2
Update entity browser configuration.
Parameters
string $browser: Id of the entity browser.
array $configuration: Configuration array to update.
array $oldConfiguration: Only if current config is same like old config we are updating.
Return value
bool Indicates if config was updated or not.
4 calls to _thunder_media_update_entity_browser_config()
- thunder_media_update_8004 in modules/
thunder_media/ thunder_media.install - Enable auto_open for gallery browser.
- thunder_media_update_8005 in modules/
thunder_media/ thunder_media.install - Update dropzonejs widget file extension filtering for images.
- thunder_media_update_8006 in modules/
thunder_media/ thunder_media.install - Enable auto_select on multiple_image_browser.
- thunder_media_update_8102 in modules/
thunder_media/ thunder_media.install - Introduce image and video paragraph.
File
- modules/
thunder_media/ thunder_media.install, line 145 - Contains.
Code
function _thunder_media_update_entity_browser_config($browser, array $configuration, array $oldConfiguration = []) {
if (!_thunder_media_update_config('entity_browser.browser.' . $browser, $configuration, $oldConfiguration)) {
return FALSE;
}
/** @var \Drupal\Core\TempStore\SharedTempStoreFactory $temp_store_factory */
$temp_store_factory = \Drupal::service('tempstore.shared');
$entity_browser_config = $temp_store_factory
->get('entity_browser.config');
// Entity browser form uses ctools wizard form and if some has opened that
// form status is saved in temp storage and we want to update that status too.
$storage = $entity_browser_config
->get($browser);
if (empty($storage)) {
return TRUE;
}
foreach ($configuration as $key => $value) {
$part = $storage['entity_browser']
->getPluginCollections()[$key];
$part
->setConfiguration(NestedArray::mergeDeep($part
->getConfiguration(), $value));
}
try {
$entity_browser_config
->set($browser, $storage);
} catch (TempStoreException $e) {
return FALSE;
}
return TRUE;
}