Created
June 23, 2022 10:50
-
-
Save sivaji/4a497c7b87e53c3ac416a162fc89f5fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/modules/custom/es_data/es_data.module b/modules/custom/es_data/es_data.module | |
index cb543233..af8d7ace 100644 | |
--- a/modules/custom/es_data/es_data.module | |
+++ b/modules/custom/es_data/es_data.module | |
@@ -229,6 +229,22 @@ function es_data_commerce_store_presave(EntityInterface $entity) { | |
]; | |
$entity->set('address', [$default_addresss]); | |
} | |
+ | |
+ $platforms_available = ['facebook', 'flickr', 'googleplus', 'instagram', 'linkedin', 'pinterest', 'twitter', 'vimeo', 'whatsapp', 'youtube', 'youtube_channel']; | |
+ $platforms = $store_obj->get('field_store_sml')->platform_values; | |
+ foreach ($platforms_available as $platform) { | |
+ if (!isset($platforms[$platform]) { | |
+ $platforms[$platform]['value'] = ''; | |
+ } | |
+ } | |
+ $field_sml = [ | |
+ [ | |
+ 'platform' => NULL, | |
+ 'value' => NULL, | |
+ 'platform_values' => $platforms | |
+ ], | |
+ ]; | |
+ $entity->set('field_store_sml', $field_sml); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment