我正在使用Ctools依賴關係來使字段集隱藏起來。這是我的代碼的一部分:Drupal:如何使用CTools依賴現場集合
$form['profile-status'] = array(
'#type' => 'radios',
'#title' => '',
'#options' => array(
'new' => t('Create a new profile.'),
'select' => t('Use an existing profile.'),
),
);
$form['select'] = array(
'#type' => 'select',
'#title' => t('Select a profile'),
'#options' => $options,
'#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:profile-status' => array('select')),
);
$form['profile-properties'] = array(
'#type' => 'fieldset',
'#title' => t('View the profile'),
'#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:profile-status' => array('select')),
'#input' => true,
);
在上面的代碼片段中,有兩個元素,一個select和一個fieldset。兩者都有#process和#dependency參數,並且都指向依賴值的一個字段。問題是像select或textfield這樣的元素可以很容易地隱藏,但它不適用於fieldset。在this支持請求頁面,CTools創建者已經提到'#input' => true
是一個工作。正如你看到的,我將它添加到代碼中,但它不工作。
你有什麼建議嗎?