0
我想隐藏以嵌入式表单呈现的字段集合字段。此表单在几个不同的节点上呈现,但只有一些节点需要所有字段,所以我想将它们隐藏在没有的节点上。隐藏嵌入式表单中的字段集合字段
现在,我正在尝试使用vis hook形式修改它,但它在字段集合内不起作用,它将在通常与该集合共享字段的表单上工作。
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;
}