How to display an input select with all (or filtered) entities?

Here’s something that i use for this.