Skip to main content
3 of 3
deleted 4 characters in body

As @apaderno mentioned, one possible solution is to manipulate the form field (field_domain_access).

function module_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  try {
    if (array_key_exists('field_domain_access', $form)) {
      $node = $form_state->getFormObject()->getEntity();

      if ($node->isNew()) {
        $form['field_domain_access']['widget']['#default_value'] = ['www_example_ch', 'www_example_com'];
      }
    }
  } catch(\Throwable $any) {
    \Drupal::logger('global')->info('Exception: %msg', ['%msg' => $any->getMessage() ]);;
  }
}

I'm not a big fan of this approach. Probably I don't understand the system good enough yet.