Created
November 3, 2016 17:18
-
-
Save zerolab/39b65abef5ff42e6844072f0ac6f5750 to your computer and use it in GitHub Desktop.
Drupal 8 move something to the advanced tabs on node forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This worked perfectly. Thanks!!!