function thunder_media_update_8104 in Thunder 8.2
Increase number of items per page to 24 in entity browser.
File
- modules/
thunder_media/ thunder_media.install, line 870 - Contains.
Code
function thunder_media_update_8104() {
/** @var \Drupal\update_helper\Updater $updater */
$updater = \Drupal::service('update_helper.updater');
$updateLogger = $updater
->logger();
// List of configurations that should be checked for existence.
$expectedConfig['display']['default']['display_options']['pager']['options']['items_per_page'] = 20;
// New configuration that should be applied.
$newConfig['display']['default']['display_options']['pager']['options']['items_per_page'] = 24;
$successfulUpdate = TRUE;
foreach ([
'video_browser',
'image_browser',
] as $viewId) {
if (_thunder_media_update_config('views.view.' . $viewId, $newConfig, $expectedConfig)) {
$updateLogger
->info(t('Configuration is successfully changed for @view view.', [
'@view' => $viewId,
]));
}
else {
$successfulUpdate = FALSE;
$updateLogger
->warning(t('Unable to adjust entity browser view config'));
}
}
if (!$successfulUpdate) {
$updateLogger
->warning(t('We were unable to adjust entity browser view configs to display 24 instead of 20 items.'));
}
return $updateLogger
->output();
}