// May 09 2016

How to get fields list in drupal 8

If you want to get all field list of a specific field type in Drupal 8 there is a easiest way to get them. Lets say you want to get all entity reference fields from all content types.

You just need to use this function in your class. You also need to load entity manager service into class.

$ref_fields = $this->entityManager->getStorage('field_storage_config')->loadByProperties(
        'settings' => array(
          'target_type' => 'node',
        'entity_type' => 'node',
        'type' => 'entity_reference',
        'deleted' => FALSE,
        'status' => 1,

More from