I have created a custom Entity using drupal generate:entity:content
.
This works great overal: I can use it in my code like I want.
One of the table columns of the entity is a node-reference. This works as well. However I have created an (admin) view in which I list the entities and want to create an exposed filter to filter by the titles (in a selectbox) of the referenced nodes. I can't find out how to do that.
When I create a view of nodes in which I reference to other nodes I can easily create such an exposed filter by choosing "Referenced .. something". With my custom entity I don't get such a choice. I think I must do something in my EntityListBuilder or my Entity class itself.
Currently the only reference in code to the NodeReference is the field definition in my Entity which looks like this:
$fields['competitor'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Competitor'))
->setDescription(t('Competitor'))
->setSetting('target_type', 'node')
->setReadOnly(TRUE);
I mentioned nothing else about this field in either my entity-class, nor in my EntityListBuilder class. So anything missing there?
Can someone help me out?