I am trying to hide a field collection field that renders in an embedded form. This form renders on a few different nodes but only some nodes need all the fields, so I would like to hide them on ones that don't.
Right now I am trying to do it vis hook form alter but it doesn't work inside the field collection, it will work on a form rendered normally that shares fields with the collection.
function zenstrap_form_alter(&$form,&$form_state,$form_id){
//Form we want to target
case ($form_id==="coh_pow_node_form"):
//Appears in Normal form and Field Collection
//Hides in normal
$form['field_last_name']['#access']=FALSE;
//Appears in Normal form and Field Collection
//Hides in normal
$form['field_street']['#access']=FALSE;
//Appears in Field Collection
//Does nothing
$form['field_veteran_retired']['#access']=FALSE;
break;
}
To Hide field collection fields check the code below.
Hope it helps you...