We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.

Tutorials

More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsCMS TutorialsDrupal

How to move certain CCK fields (groups, title, body, etc.) into field groups

Cloud Servers 727 × 90

It might came to our attention there are certain fields in the content management panel like “Groups”, “Title”, “Body”, etc. However, those fields cannot be moved to the group of fields by dragging them. In case we want to have them moved to the group of fields, it will require to modify Drupal code in order to implement this functionality.

Here we will provide an example code which can be used for moving the fields in question to the group.

1
2
3
array_push($form['group_whatever'], $form['body_filter']);
$form['body_filter'] = array();
print drupal_render($form);

This code puts body field in the array of group field and removes old body field.

Next step is to implement custom functions in order to override forms with template files. For this reason we will need to put the following code entry in the template.php file:

1
2
3
4
5
function phptemplate_node_form($form) {
if ($form['form_id']['#value'] == 'your_node_form_id') {
return _phptemplate_callback('mytype_edit', array('form' => $form));
}
}

Finally, create file named “type_edit.tpl.php” where “type” is the name of the content type. This file will be used for placing node forms overrides. Basically it should be enough to implement the mentioned code to move required fields into field group.

Rate this Tutorial:
No Comments Leave a Comment
Leave a Comment

Cloud Servers 1 230×230

Other (195)

Popular Keywords

Cloud Servers 1 230×230