by slashrsm: Leverage event system to handle entity selection.

https://www.drupal.org/node/2352087