Drupal 6 隐藏修订信息
我试图向不了解与此内容类型相关的内容的用户隐藏“修订信息”。我在网上阅读了大量帖子,其中提出了从更改模板到设置 style="display: none" 的任何建议。我宁愿实际上从访问中删除该字段,以便注入技术仍然不可行。我通过创建一个来做到这一点 hook_form_alter
设置 $form['revision_information']['#access'] = false;
。我已经使用 Firebug 验证了该方法确实被调用,但表单元素占上风。有什么想法吗?提前致谢!德鲁帕尔岩石!
function recipe_form_recipe_node_form_alter(&$form, $form_state){
if (isset($form['revision_information'])) {
$form['revision_information']['#access'] = FALSE;
firep(print_r($form['revision_information'],true));
$form_state['rebuild'] = true;
}
}
I'm trying to hide "Revision information" from my users who do not understand what that is in relation to this content type. I've read numerous posts online that suggest anything from changing a template to setting style="display: none". I'd prefer to actually remove the field from access so that injection techniques aren't still viable. I've done this by creating ahook_form_alter
that sets $form['revision_information']['#access'] = false;
. I've verified with Firebug that the method is indeed called, yet the form elements prevail. Any thoughts? Thanks in advance! Drupal rocks!
function recipe_form_recipe_node_form_alter(&$form, $form_state){
if (isset($form['revision_information'])) {
$form['revision_information']['#access'] = FALSE;
firep(print_r($form['revision_information'],true));
$form_state['rebuild'] = true;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
引用 marcvangend
这可能是最简单的选择。
注意:wiki 答案,因为它不是我自己的
Quoting marcvangend
This would probably be the easiest option.
Note: wiki answer as it is not my own