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.

1 Answer 1


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(&$form, FormStateInterface $form_state,  $form_id) {

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.