0

I have a view that lists all the orders. I want an action/operations column in the view which has buttons/links for eg: edit, repeat, delete, upload, download, reset, print. I cannot find a way to include a custom column in my view.

enter image description here

Current "Operations links" Columns shows me some menus which are added by default. Can I change them or can i add another column with my own choice of buttons/links ?

1 Answer 1

0

You have two "simple" options and a third "hard" option, which involves writing a custom Views field ... I'm going to skip that one and focus on the simpler options.

  1. Those links all share a common pattern with only the order ID changing based on the row you're looking at. You can use tokens ("replacement patterns") in custom text fields on Views, including the order ID if you've added it to the View's fields list. This means your first option is to add the Order ID field to the View (and hide it by "excluding it from display") and then add a custom text field that adds whatever HTML you want, using the order ID token in the URLs.
  2. The other option would be to add custom CSS to the View that alters the dropbutton styling. In the default HTML for that operations column, it's just using CSS to turn multiple links into that dropbutton format. You can undo that with your own CSS if you'd like, using the classes on the individual links to pick the right icon or whatever from your theme (e.g. "edit", "delete", etc.).

Either one of these solutions will be much simpler than writing custom Views code, and the second doesn't involve editing the View at all. : )

3
  • i'm not able to understand the first answer. Can I change the HTML like I can change the twig ? So that I can change the links in that dropdown? Mar 2, 2020 at 4:49
  • No. I said to add your own custom text field in Views. If you aren't sure what that is, you may need to find a more step-by-step guide on managing Views first. Mar 2, 2020 at 15:47
  • Hi @Ryan Szrama. I made it work for view, edit and delete by including these 3 columns and then excluding from display. And then adding custom text and using replacement patterns to display the 3 links. Now I have 3 more links/buttons to display. Upload, Download & Print. Can you help me with these ? Mar 3, 2020 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.