2 added 1 character in body
source | link

Thanks for the comments, I figured out a way to get the number(cardinality). Hope it helps someone.

(array) $user_fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('user', 'user');

foreach ($user_fields as $user_field_name => $user_field_definition) {
    (array) $cardinality = $user_field_definition->get('fieldStorage')->get('cardinality');
}

Thanks for the comments, I figured out a way to get the number(cardinality). Hope it helps someone.

(array) $user_fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('user', 'user');

foreach ($user_fields as $user_field_name => $user_field_definition) {
    (array) $cardinality = $user_field_definition->get('fieldStorage')>get('cardinality');
}

Thanks for the comments, I figured out a way to get the number(cardinality). Hope it helps someone.

(array) $user_fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('user', 'user');

foreach ($user_fields as $user_field_name => $user_field_definition) {
    (array) $cardinality = $user_field_definition->get('fieldStorage')->get('cardinality');
}
1
source | link

Thanks for the comments, I figured out a way to get the number(cardinality). Hope it helps someone.

(array) $user_fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('user', 'user');

foreach ($user_fields as $user_field_name => $user_field_definition) {
    (array) $cardinality = $user_field_definition->get('fieldStorage')>get('cardinality');
}