Form display: How to move fields into the advanced group? How can I move a field in a node edit form from the main region into the advanced/secondary group region in the right-hand column?

This question asks how to move elements out of the secondary group into the main group, but this is the inverse.

I tried setting a group for my field in a similar way to the above answer:

$form['field_article_language_filter']['#group'] = 'advanced';


This did move it, but I'd like it to be in a group with a summary arrow button to toggle it closed or open.
In a custom module or your theme, create a group and place your field in there:

/*
* Implements hook_form_alter()
* @param     Array $form, Object $form_state, Array $form_id
* @return    Array $form
*/
function MY_MODULE_form_node_form_alter(&amp;$form, FormStateInterface $form_state,  $form_id) {

  // Create a languages group in the right-hand column
  $form['languages'] = [
    '#type' =&gt; 'details',
    '#title' =&gt; t('Languages'),
    '#group' =&gt; 'advanced',
    '#attributes' =&gt; [
      'class' =&gt; ['node-form-options']
    ],
    '#attached' =&gt; [
      'library' =&gt; ['node/drupal.node'],
    ],
    '#weight' =&gt; 100,
    '#optional' =&gt; TRUE,
    '#open' =&gt; TRUE,
  ];

  // Move the languages settings to the right-hand column
  $form['field_article_language_filter']['#group'] = 'languages';

  return $form;
}


This is based on this gist, thanks to Dan Braghis.