I am trying to get the custom fields created for the User entity in Drupal 8.
Drupal::service('entity_field.manager')->getFieldStorageDefinitions('user')
returns all the fieldsDrupal::service('entity_field.manager')->getFieldDefinitions('user', '')
returns only the default fields
My code creates the list by removing the fields returned from getFieldDefinitions('user', '')
by the fields returned from getFieldDefinitions('user'
.
Is there a proper way to achieve this?