3

I want to tweak the node add/edit form for one of my content-types and rearrange the fields in different groups.

I use the Field Group Module to setup the different groups.

On the Manage Form Display settings of the content-type I rearrange the Fields, which works fine for all fields but "Authored by", "Promoted to front page" and so on. All this fields are rendered in an "advanced" container, no matter what.

This is also part of the classy theme file node-edit-form.html.twig

  <div class="layout-region layout-region-node-main">
    {{ form|without('advanced', 'actions') }}
  </div>
  <div class="layout-region layout-region-node-secondary">
    {{ form.advanced }}
  </div>

Is there any way to break this up, so I can move the containing fields into different groups, just like any other field?

1
  • 1
    Dunno but just FYI those fields are Extra fields, not Field API fields so there might be some limitations in place.
    – user21641
    Commented Jan 7, 2016 at 13:44

1 Answer 1

3

These Fields are organized in different groups in NodeForm::form.

So the settings from Manage Form Display wont work until the #group property of the fields is unset or the surrounding container is unset.

This can be done with one of the form alter hooks in your theme or custom module.

For example the hook_form_BASE_FORM_ID_alter:

function your_theme_form_node_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
    unset($form['author']);
}

This will unset the author container. The containing fields Authored on and Authored by can than be moved around with the Manage Form Display Form.

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.