I have a custom entity type with custom fields, one of them is an entity_reference type , I saw this question How to create entity reference field from custom entity to specific content type , and according to it some references I googled , try the below code but it not works .
$fields['book_cat'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Book Category'))
->setDescription(t('Book Category Name'))
->setSetting('target_type','taxonomy' )
->setSetting('handler','default' )
->setTranslatable(TRUE)
->setDisplayOptions('form', array(
'type' => 'options_select',
'weight' => -1,
'handler_settings' => array(
'target_bundles'=>['book_cat_agency'=>'book_cat_agency'],
'size' => '60',
'placeholder' => '',
),
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
But not working.
my vocab name is : book_cat_agency