Implements hook_field_settings_form().
function entity_reference_field_settings_form($field, $instance, $has_data) {
// Select the target entity type.
$entity_type_options = array();
foreach (entity_get_info() as $entity_type => $entity_info) {
// @todo As the database schema can currently only store numeric IDs of
// referenced entities and configuration entities have string IDs, prevent
// configuration entities from being referenced.
if (!in_array('\\Drupal\\Core\\Config\\Entity\\ConfigEntityInterface', class_implements($entity_info['class']))) {
$entity_type_options[$entity_type] = $entity_info['label'];
}
}
$form['target_type'] = array(
'#type' => 'select',
'#title' => t('Type of item to reference'),
'#options' => $entity_type_options,
'#default_value' => $field['settings']['target_type'],
'#required' => TRUE,
'#disabled' => $has_data,
'#size' => 1,
);
return $form;
}