Drupal:如何使用CTools使字段集依赖
发布时间:2020-12-14 04:56:39 所属栏目:百科 来源:网络整理
导读:我正在使用Ctools依赖项使字段集可隐藏.这是我的代码的一部分: $form['profile-status'] = array( '#type' = 'radios','#title' = '','#options' = array( 'new' = t('Create a new profile.'),'select' = t('Use an existing profile.'),),);$form['select
我正在使用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'),'#input' => true,); 在上面的代码片段中,有两个元素,一个是select,一个是fieldset.两者都有#process和#dependency参数,并且都指向依赖值的一个字段.问题是像select或textfield这样的元素可以很容易地隐藏,但它不适用于fieldset.在this支持请求页面中,CTools创建者提到’#input’=>真的是一种解决方法.如您所见,我将其添加到代码中,但它不起作用. 你有什么建议吗? 解决方法
在阅读了CTools依赖的来源后,我找到了答案. Fieldset应该改变如下:
$form['profile-properties'] = array( '#type' => 'fieldset','#id' => 'my-fs-id','#prefix' => '<div id="my-fs-id-wrapper">','#suffix' => '</div>',); 首先,必须为他的字段集设置ID.然后它必须包装在DIV标签中. DIV的ID应该是feildset的ID,后缀为’-wrapper’. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 10.1 oracle alert.log中'Process Q000 Started Up But
- dojo之ajax
- 如何关闭Scene Kit中的环境光(使用Swift)?
- ruby – 如何为命名空间类定义Fabricator
- 未解决的依赖关系SBT org.scala-sbt#sbt_2.9.1; 0.12.1:未
- swift – 使用反射来设置对象属性,而不使用setValue forKey
- jqGrid上有隐藏/显示列功能,如flexigrid吗?
- cocos2dx之onEnter,onExit
- Flash将于2020年停止开发和更新!Chrome:感谢Flash做出的贡
- vb.net版机房收费系统后的一些感触