我正在使用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
是一个工作。正如你看到的,我将它添加到代码中,但它不工作。
你有什么建议吗?