Currently i use this to programmatically add user fields:
function openid_connect_entity_base_field_info(EntityTypeInterface $entity_type) {
if ($entity_type->id() === 'user') {
$fields['field_family_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Family Name'))
->setDescription(t('Add a description'))
->setRevisionable(TRUE)
->setTranslatable(TRUE)
->setDisplayOptions('form', array(
'type' => 'string_text_field',
'weight' => 30,
'default_value' => 0,
))
->setDisplayConfigurable('form', TRUE);
}
return $fields;
}
but it results in the admin of the site unable to uninstall my module as shown:
Are there any alternative ways to programmatically add user fields without causing the admin of the website to be unable to uninstall the module that programmatically added the user fields?