Posted by candelas on December 12, 2012 at 1:20am
hello and sorry for my bad english
i have not much experience doing a custom module.
i am doing one where i want to take out a element from vertical tabs.
is there an opposite way to form_process_vertical_tabs ?
thanks
Comments
It depends on the item, but
It depends on the item, but since a lot of vertical menu items are for administrative purposes there may be a permission that controls access. But it depends on what you want to remove and what form it is in.
description of the form
thanks @nevets to answer :)
i am using the distribution commerce kickstart 7.x-2.0-rc4 (which goes with drupal core version 7.17).
in the node add form, all the fields but the tittle are included in vertical tabs, in a fieldset called additional_settings.
fields from core, like author, i can take out of the fieldset in a costum module (i am learning this) with
<?phpfunction my_module_form_alter(&$form, &$form_state, $form_id) {
if (substr($form_id, -10) == '_node_form') {
unset($form['author']['#group']);
}
}
i use devel.
and the fieldset created by kickstart doesnt have #group, so this doesnt work.
also if i use
unset($form['additional_settings']);the fields that are core drupal get out of the fieldset, but the one that is created by kickstart is unset too and i dont get it :(
can you give to me any tips where i can look? :)
thanks for you time :)
//trying to answer one question for each one that i make.
//this way, drupal will be more friendly and strong
the need
one kind of role has no permissions to change the other options on the node add form and sees this.
I would like it to be out of there, next to the tittle.
//trying to answer one question for each one that i make.
//this way, drupal will be more friendly and strong
solution
i put the module weight to 1000 for it to be the last to be processed
<?phpfunction MODULENAME_form_node_form_alter(&$form, $form_state) {
if (user_is_logged_in() == TRUE) {
global $user;
// i need it only for not admin users
if($user->name <> 'admin'){
// i had to hide the container in vertical tabs
$form['product_catalog']['#access'] = FALSE;
unset($form['field_collection']['#fieldset']);
// i changed the weight to be above the variations
$form['field_collection']['#weight']='1';
}
}
}
?>
//trying to answer one question for each one that i make.
//this way, drupal will be more friendly and strong