简体   繁体   English

Drupal:视图上节点的自定义“操作”按钮

[英]Drupal: Custom “Action” Button for nodes On a View

I have a view listing different "task" nodes called "available tasks" I wish to have a button for every listing that will enable the user to assign the "task" to themselves. 我有一个视图,列出了称为“可用任务”的不同“任务”节点,我希望每个列表都有一个按钮,使用户能够为自己分配“任务”。 My "task" node has a user reference field called "assigned to". 我的“任务”节点有一个用户参考字段,称为“分配给”。 So all i need is a button next to every "task" node in my "available tasks" view clicking on which will set the user reference field "assigned to" of the "task" node to the current user. 因此,我需要做的是在“可用任务”视图中每个“任务”节点旁边单击一个按钮,单击该按钮会将“任务”节点的用户参考字段“分配给”设置为当前用户。 If any one can point me in the right direction; 如果有人能指出我正确的方向; it will be greatly appreciated. 将不胜感激。 Thanks 谢谢

I would recommend the Views Bulk Operations module. 我建议使用“ 视图批量操作”模块。 With that you can add a 'Display' to your view, then set its 'Style' under 'Basic Settings' to 'Bulk Operations'. 这样,您可以在视图中添加“显示”,然后在“基本设置”下将其“样式”设置为“批量操作”。 Assuming you already have a 'Page' display on your view which lists out your content, then you can attach the new VBO display to your page. 假设您的视图上已经有一个“页面”显示,其中列出了您的内容,那么您可以将新的VBO显示附加到页面上。

You will need to configure your VBO display to allow 'Modify node fields', then choose your user reference field from your content type as the field to modify. 您将需要配置VBO显示以允许“修改节点字段”,然后从内容类型中选择用户参考字段作为要修改的字段。

When that is done, save your view, then navigate to your page. 完成后,保存您的视图,然后导航到页面。 You should then see a checkbox next to each item in your view, and a button that will allow you to bulk modify the user reference field on whichever nodes are selected. 然后,您应该在视图中的每个项目旁边看到一个复选框,以及一个按钮,该按钮将使您可以在所选的任何节点上批量修改用户参考字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM