hello and sorry for my english...

in the site that i am building, in the node add form i want to change the place that the collection select has because it takes too much space for what is (see attached field).
i have rearranged the field, in the manager for the content type, but always the vertical tabs take it and put at the end.
i have made a custom module but i cant make it to be out of the fieldset.
maybe you can give to me a tip and i can do it :)
i have search a lot, but my bad english doesnt help :(

i have tried with the admin user in the costum module to compare with other nested fields (options, author, etc)

unset($form['additional_settings']);

the other elements get out but the product catalog disappears.

also i tried

unset($form['options']['#group']);

but field_collection has not #group...
and it is inside product_catalog that is inside additional_settings

after hours of studying, i dont find a way...
thanks for any help :)

CommentFileSizeAuthor
collection.png8.58 KBcandelas
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

candelas’s picture

any tips, please? :)

bastnic’s picture

something like that might help you:

/**
 * Implements hook_form_BASE_FORM_ID_alter() for node_form().
 */
function YOURMODULENAME_form_node_form_alter(&$form, $form_state) {
  if ($form['type']['#value'] === 'YOUR CONTENT TYPE') {
    unset($form['YOURFIELDNAME']['#fieldset']);
  }
}

make sure your module is being loaded after the commerce_kickstart modules.

candelas’s picture

@bastnic thanks for your help :)

i tried but i get this error

Fatal error: Call to undefined function commerce_entity_access() in /xx/drupal/profiles/commerce_kickstart/modules/contrib/commerce/modules/product/commerce_product.module on line 601

thanks for any tip :)

candelas’s picture

i think i am very tired... tomorrow i will try to see :)
thanks!

candelas’s picture

@bastic thanks for the help :)
i have search in internet and i dont found how to make that my costum module loads the last.
can you help to me, please?

edit: i found in the system table the weight. i put it 1001, since there was one 1000, but the code that you gave to me doesnt work (i put module name and contentypename).
other code works ...

any tip, please? :)

candelas’s picture

Status: Active » Closed (fixed)

i put the module weight to 1000 and now all works... :)

<?php
  function 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';
          } 
      }
  }
?>

thanks for your tips :)