Skip to content

Instantly share code, notes, and snippets.

@zerolab
Created November 3, 2016 17:18
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zerolab/39b65abef5ff42e6844072f0ac6f5750 to your computer and use it in GitHub Desktop.
Save zerolab/39b65abef5ff42e6844072f0ac6f5750 to your computer and use it in GitHub Desktop.
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
Copy link

This worked perfectly. Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment