How to know when a field is a paragraph I'd like to know when a field from a node it's a paragraph, I only get the type, that it's entity_reference_revisions, I use this method to get the information:

\Drupal\field\Entity\FieldStorageConfig::loadByName()


But I'm not able to get this information

 [settings:protected] =&gt; Array
    (
        [target_type] =&gt; paragraph
    )


The only way I get it's to check directly to the database to see it the name of the field it's in the table paragraphs_item_field_data.

Thanks

Oskar
You're probably looking for the EntityFieldManager service. It is available from the container as entity_field.manager. Its EntityFieldManager::getFieldDefinitions() method returns the field definitions for all fields that belong to a certain entity type and bundle (content type), keyed by their field names:

$definitions = \Drupal::service('entity_field.manager')-&gt;getFieldDefinitions('node', 'page');
if (
  isset($definitions['field_to_check'])
  &amp;&amp; $definition = $definitions['field_to_check']
  &amp;&amp; $definition-&gt;getSetting('target_type')
  &amp;&amp; $definition-&gt;getSetting('target_type') == 'paragraph'
) {
  // Is a field of a 'node' entity, belongs to the bundle
  // 'page', has the 'target_type' property, and finally
  // references paragraphs.
}


If you load the field storage definition using FieldStorageConfig::loadByName() only, you need to be careful: Field definitions can be different for the various bundle (content) types. So you'd need to additionally check, whether your bundle (content type) matches the bundle of the node you are investigating the reference field for.