How do I get a form field value out of a config entity data blob? I am trying to add a form field in a existing config entity form.
The value of the field is stored in the data blob of the correct config entity but I am not able to get it out of it.

/**
* Implements hook_form_FORM_ID_alter().
*/
function my_module_form_field_config_edit_form_alter(&amp;$form, FormStateInterface $form_state) {
 $someEntity = \Drupal::entityTypeManager()-&gt;getStorage('some entity');
 $form['my-field'] = [
  '#type' =&gt; 'number',
  '#title' =&gt; 'some title',
  '#weight' =&gt; 1,
  '#min' =&gt; '0',
  '#max' =&gt; '50',
  '#default-value' =&gt; $someEntity-&gt;getValue('my-field'), // Here I would like to get the Value that is stored in the db
 ];
 $form['#validate'][] = 'my_module_field_config_edit_form_validate';     
}  


@Berdir

I tried your answer but the value still won't be set as default_value

    /**
     * Implements hook_form_FORM_ID_alter().
     */
function comment_limit_form_field_config_edit_form_alter(&amp;$form, FormStateInterface $form_state) {
  $comment = $form_state-&gt;getFormObject()-&gt;getEntity();
  $form['edit-limit-per-user'] = [
    '#type' =&gt; 'number',
    '#title' =&gt; 'Comment limit per user',
    '#weight' =&gt; 1,
    '#min' =&gt; '0',
    '#max' =&gt; '50',
    '#default_value' =&gt; $comment-&gt;getThirdPartySetting('comment_limit', 'edit-limit-per-user', FALSE),
  ];
  $form['#validate'][] = 'comment_limit_field_config_edit_form_validate';
  $form['#entity_builders'][] = 'comment_limit_form_field_edit_form_add_form_builder';
}

/**
 *
 */
function comment_limit_form_field_edit_form_add_form_builder($entity_type, FieldConfig $comment , &amp;$form, FormStateInterface $form_state) {
  $comment-&gt;setThirdPartySetting('comment_limit', 'edit-limit-per-user', $form_state-&gt;getValue('edit-limit-per-user'));
}  


comment.type.comment.third_party.comment_limit:
  type: mapping
  label: 'Comment limit per user'
  mapping:
    edit_limit_per_user:
      type: number
      label: 'Comment limit per user'


Did I miss something?

This works for me:)
The entity is already available with $form_state-&gt;getFormObject()-&gt;getEntity(). That basically answers your question.

Note that stuffing arbitrary keys into a config entity is not supported, you should use the third party settings API instead. See http://larowlan.github.io/meet-third-party-settings-interface/#/12 for a simple example (but make sure you also check the slides before about config schema). The initial part is not necessary anymore as all config entities support third party settings out of the box now.