Get list of custom fields and update their settings programatically I'm using D8's core contact form, I have added some custom fields and I want to change one of custom fields' settings config programatically.

I have tried this

\Drupal::service('entity_field.manager')-&gt;getFieldDefinitions('contact_form')


but I get error:

LogicException: Getting the base fields is not supported for entity type Contact form. in Drupal\Core\Entity\EntityFieldManager-&gt;buildBaseFieldDefinitions() (line 204 of core/lib/Drupal/Core/Entity/EntityFieldManager.php).


Is there any way to get list of fields and update their configs and settings?
Try this one:

$fields = \Drupal::service('entity_field.manager')-&gt;getFieldDefinitions('contact_message', 'personal');

You can change personal to your contact form bundle.