function social_profile_fields_update_8003 in Open Social 10.2.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_profile/modules/social_profile_fields/social_profile_fields.install \social_profile_fields_update_8003()
- 10.1.x modules/social_features/social_profile/modules/social_profile_fields/social_profile_fields.install \social_profile_fields_update_8003()
Add a field for nationality.
File
- modules/
social_features/ social_profile/ modules/ social_profile_fields/ social_profile_fields.install, line 82 - The social profile fields install file.
Code
function social_profile_fields_update_8003() {
$entity_type_ids = [
'taxonomy.vocabulary.' => 'taxonomy_vocabulary',
'field.storage.profile.field_profile_' => 'field_storage_config',
'field.field.profile.profile.field_profile_' => 'field_config',
];
$path = drupal_get_path('module', 'social_profile_fields') . '/config/static/';
foreach ($entity_type_ids as $prefix => $entity_type_id) {
$config_file = $path . $prefix . 'nationality_8003.yml';
$settings = Yaml::parseFile($config_file);
/** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $storage */
$storage = \Drupal::entityTypeManager()
->getStorage($entity_type_id);
$storage
->createFromStorageRecord($settings)
->save();
}
_social_profile_fields_nationalities();
}