Get all fields defined in a bundle In Drupal 7, to get all fields used in a content type, I use the following code.
$fields = field_info_instances('node', 'article');

What is the equivalent for Drupal 8?
EntityManager is deprecated moving forward.  The following can be used instead:
$entityFieldManager = \Drupal::service('entity_field.manager');
$fields = $entityFieldManager-&gt;getFieldDefinitions($entity_type, $bundle);

Whereas $entity_type can be 'node' and $bundle can be 'article'