如何删除 Drupal 视图中显示的节点?
Drupal 6。
我创建了一个节点类型,其中仅包含一个正文文本字段(标题使用 auto_nodetitles 隐藏),并且我通过视图显示该类型的所有节点。
我希望节点的作者能够单击视图中节点项旁边的“删除”链接以将其删除(就像通常通过 /admin/content/node/overview 删除节点一样)。
执行此操作的最佳方法是什么?
Drupal 6.
I have created a node type which consists of just a body text field (the title is hidden using auto_nodetitles), and I am displaying all nodes of this type through a view.
I want the author of the node to be able to click a "delete" link somewhere next to the node item in the view to have it removed (as you would delete a node through /admin/content/node/overview normally).
What is the best approach to doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过Views,可以输出节点编辑/删除链接;但是,您必须在管理页面中确认删除。
我建议您编写一个具有删除节点功能的自定义模块,但无需确认。按照以下步骤编写这个简单的模块(您可以使用现有的自定义模块):
hook_menu()
的实现,它定义一个带有通配符的菜单项,以接收节点 ID 作为参数(更多内容请参见此处) 此处)Via Views, you can output node edit/delete links; however, you'll have to confirm the deletion as in the administrative pages.
I suggest you to write a custom module with the function to delete nodes, but without confirming. Write this simple module (you could use your existing custom module) following these steps:
hook_menu()
, which defines a menu item with wildcard to receive the node ID as argument (more on this here)