An entity-bound allowed values callback.
function options_test_dynamic_values_callback($field, $instance, $entity_type, $entity, &$cacheable) {
$cacheable = FALSE;
// We need the values of the entity as keys.
return drupal_map_assoc(array(
$entity->ftlabel,
$entity
->id(),
$entity
->getRevisionId(),
$entity
->bundle(),
));
}