Where to find all possible keys for BaseFieldDefinition -> setSettings() I am a noob to Drupal. I am trying to create a module and am currently in the process of creating a content entity and defining its base fields. Can anyone tell me where I can find a list of possible keys for the setSetting method? In other modules I have seen things like:

 BaseFieldDefinition::create('entity_reference')
  ...
  ...
  ...
  -&gt;setSetting('target_type', 'commerce_store')
  -&gt;setSetting('handler', 'default')


How is it that the module creator knew to use target_type and handler??
Any help is much appreciated. I am very confused.
The settings are specific to each field type, and each type can provide both storage and field settings (storage settings apply to the field as a whole, per type of entity it's used in, and field settings are the per-bundle settings).

For example, the entity_reference type, backed by the EntityReferenceItem class, provides a target_type storage setting, and several field settings (including handler).

You can use the API to get the default settings, which equate to the available settings that you're looking for, like this:

$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
$storage_settings = $field_type_manager-&gt;getDefaultStorageSettings('entity_reference');
$field_settings = $field_type_manager-&gt;getDefaultFieldSettings('entity_reference');


That gets you something like this:



If you need to inspect the code to find out what's going on, you can find the class responsible for a particular field type with the same service:

$class = $field_type_manager-&gt;getDefinition('entity_reference')['class'];