drupal,cck---删除“N/A”从单选按钮选项列表中
以下代码来自其文档,太抽象了。期望有人可以帮助我如何去做。
使用预处理函数删除 CCK N/A 字段...
在将无线电分配给变量之前,请使用以下代码:
<?php
unset($vars['form']['group_if_in_fieldset']['field_the_radios']['value']['']); //remove the pesky CCK N/A radio
?>
我已将代码放入 mytheme_preprocess_node(){} 但它无法工作。
the follow code is from it's documentation,it's too abstract. expect someone can help me how to do it.
Removing CCK N/A field using a preprocess function...
Before you assign your radios to a variable use the following code:
<?php
unset($vars['form']['group_if_in_fieldset']['field_the_radios']['value']['']); //remove the pesky CCK N/A radio
?>
i have put the code into the mytheme_preprocess_node(){} but it can't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想删除 N/A 然后将该字段设置为必填字段,则该字段应该消失。
if you want to remove N/A then make the field required, it should go away.
我的猜测是用作索引的字符串只是占位符。如果您创建了一个名为“item_status”的 CCK 字段,则您的字段可能会被称为“field_item_status”,而不是“field_the_radios”。字段集组名称也是如此(如果您碰巧将收音机放在一个组中)。
My guess would be that the strings used as indices are only placeholders. If you have created a CCK field called "item_status", your field will likely be called "field_item_status", not "field_the_radios". Same goes to the fieldset group name (if you happen to have your radios in a group).