Skip to content

Commit

Permalink
Islandora IIIF: Fix PHPCS errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
alxp committed Jun 29, 2024
1 parent a3e76c7 commit 923419a
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions modules/islandora_iiif/islandora_iiif.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* Install/update hook implementations.
*/

use Symfony\Component\Yaml\Yaml;

/**
* Update config schema.
*/
Expand All @@ -15,29 +13,29 @@ function islandora_iiif_update_92002(&$sandbox) {
/**
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
$config_factory = \Drupal::service('config.factory');
$all_configs = $config_factory->listAll();
$views_configs = array_values(array_filter($all_configs, function($config) {
return str_starts_with($config, 'views.view.');
}));
$config_factory = \Drupal::service('config.factory');
$all_configs = $config_factory->listAll();
$views_configs = array_values(array_filter($all_configs, function ($config) {
return str_starts_with($config, 'views.view.');
}));

foreach ($views_configs as $views_config_name) {
$needs_save = FALSE;
$view_config = $config_factory->getEditable($views_config_name);
$displays = $view_config->get('display');
foreach ($displays as $display_name => $display) {
if ($display['display_plugin'] == 'rest_export'
&& $display['display_options']['style']['type'] == 'iiif_manifest'
&&!empty($display['display_options']['style']['options']['iiif_ocr_file_field'])) {
foreach ($views_configs as $views_config_name) {
$needs_save = FALSE;
$view_config = $config_factory->getEditable($views_config_name);
$displays = $view_config->get('display');
foreach ($displays as $display_name => $display) {
if ($display['display_plugin'] == 'rest_export'
&& $display['display_options']['style']['type'] == 'iiif_manifest'
&&!empty($display['display_options']['style']['options']['iiif_ocr_file_field'])) {

$display['display_options']['style']['options']['advanced']['iiif_ocr_file_field'] = $display['display_options']['style']['options']['iiif_ocr_file_field'];
unset($display['display_options']['style']['options']['iiif_ocr_file_field']);
$view_config->set('display.' . $display_name . '.display_options.style.options', $display['display_options']['style']['options']);
$needs_save = TRUE;
}
}
if ($needs_save) {
$view_config->save();
$display['display_options']['style']['options']['advanced']['iiif_ocr_file_field'] = $display['display_options']['style']['options']['iiif_ocr_file_field'];
unset($display['display_options']['style']['options']['iiif_ocr_file_field']);
$view_config->set('display.' . $display_name . '.display_options.style.options', $display['display_options']['style']['options']);
$needs_save = TRUE;
}
}
if ($needs_save) {
$view_config->save();
}
}
}

0 comments on commit 923419a

Please sign in to comment.