Skip to content
Snippets Groups Projects
Commit c5a26c9a authored by Rajab Natshah's avatar Rajab Natshah
Browse files

Issue #2917363: Added an update function to load the new configs for Display...

Issue #2917363: Added an update function to load the new configs for Display Edge-to-Edge 4:1 image responsive image style and view mode.
parent 6162f132
No related branches found
No related tags found
No related merge requests found
......@@ -83,3 +83,32 @@ function varbase_media_update_8007() {
$data = (array) Yaml::parse($config_file);
$config->setData($data)->save(TRUE);
}
/**
* Issue #2917363: Added Display Edge-to-Edge 4:1 responsive image style.
*/
function varbase_media_update_8008() {
$config_path = \Drupal::root() . '/' . drupal_get_path('module', 'varbase_media') . '/config/install/';
$config_names = [
'image.style.de2e_4_1',
'image.style.de2e_4_1_md',
'image.style.de2e_4_1_sm',
'image.style.de2e_4_1_xs',
'responsive_image.styles.de2e_4_1',
'core.entity_view_mode.media.se2e_4_1',
'core.entity_view_display.media.image.se2e_4_1'
];
foreach ($config_names as $config_name) {
$config_file = $config_path . $config_name . '.yml';
if (file_exists($config_file)) {
$config = \Drupal::service('config.factory')->getEditable($config_name);
$config_content = file_get_contents($config_file);
$config_content_data = (array) Yaml::parse($config_content);
$config->setData($config_content_data)->save();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment