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;
}