Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Drupal 8 move something to the advanced tabs on node forms
<?php
/**
* Implements hook_form_FORM_ID_alter().
*
* Move your field or group of fields to the node form options vertical tabs.
*/
function mymodule_form_node_form_alter(&$form, FormState $form_state, $form_id) {
$form['mygroup'] = [
'#type' => 'details',
'#title' => t('My custom settings'),
'#group' => 'advanced',
'#attributes' => [
'class' => ['node-form-options']
],
'#attached' => [
'library' => ['node/drupal.node'],
],
'#weight' => 100,
'#optional' => TRUE
];
$form['my_filed'] = [
// ... type, etc.
'#group' => 'mygroup',
];
}
@aimenkhakwani

This comment has been minimized.

Copy link

aimenkhakwani commented Aug 9, 2017

This worked perfectly. Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.