How to display dynamic allowed values list in drupal 8?
In drupal 6 while creating cck select list, I written php code instead of entering allowed values. The sample code of drupal 6 is as follows :
$query = db_query("SELECT distinct field_x_value as x FROM {node} n, {content_type_y} ctdr , {content_field_x} cfer WHERE n.nid = ctdr.nid and cfer.nid = ctdr.nid and field_x_value is not null and field_user_state_value = %d and n.status = %d and field_environment_value = %d", $user->user_state, 1, $environment);
How to do the same functionality in drupal 8?