Drupal 6 隐藏修订信息

发布于 2024-08-19 04:17:23 字数 592 浏览 7 评论 0原文

我试图向不了解与此内容类型相关的内容的用户隐藏“修订信息”。我在网上阅读了大量帖子,其中提出了从更改模板到设置 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 a
hook_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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月静好 2024-08-26 04:17:23

引用 marcvangend

请注意,您还可以隐藏
修订信息正确
设置;它只会显示如果
“创建新修订版”选项是
检查,或者当前用户是否有
“管理节点”权限

这可能是最简单的选择。

注意:wiki 答案,因为它不是我自己的

Quoting marcvangend

Note that you can also hide the
revision information with the correct
settings; it will only show if the
"Create new revision" option is
checked, or if the current user has
the "administer nodes" permission

This would probably be the easiest option.

Note: wiki answer as it is not my own

殊姿 2024-08-26 04:17:23
/* Below code added by tejas tank , [email protected] 
   to disable the revision block from everywhere    
*/
function phptemplate_node_form($form) {
    $form['revision_information']['#access'] = FALSE;
    return theme_node_form($form);
}
/* Below code added by tejas tank , [email protected] 
   to disable the revision block from everywhere    
*/
function phptemplate_node_form($form) {
    $form['revision_information']['#access'] = FALSE;
    return theme_node_form($form);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文