Specify a node type (bundle) in entity reference field I have a custom entity type which has an entity reference field.

   $fields['referenced_article'] = BaseFieldDefinition::create('entity_reference')
  -&gt;setLabel(t('Article'))
  -&gt;setDescription(t('The associated article.'))
  -&gt;setSetting('target_type', 'node')
  -&gt;setSetting('handler', 'default')
  -&gt;setDisplayOptions('form', array(
    'type' =&gt; 'entity_reference_autocomplete',
    'settings' =&gt; array(
      'match_operator' =&gt; 'CONTAINS',
      'size' =&gt; 60,
      'placeholder' =&gt; '',
    ),
    'weight' =&gt; -3,
  ))
  -&gt;setDisplayConfigurable('form', TRUE);


This field returns now the nodes of all the node types when finding a match. How can I specify a node type? (I only want to show the nodes of type "article")

Do I need to use a specific setting for selecting content only one node type?
Try adding



-&gt;setSetting('handler_settings', ['target_bundles' =&gt; ['article' =&gt; 'article']]),


Source