How to add condtional action buttons for folder_contents

Hello,

I am trying to add a button to the folder_contents view of a custom folder Type. The button allows users to categorize certain items in the folder quickly. I based the code on the following examples:

  • plone/plone.app.content/blob/master/plone/app/content/browser/contents/configure.zcml#L43
  • plone/plone.app.content/blob/master/plone/app/content/browser/contents/workflow.py
    (i was not allowed to add links...)

My custom configure.zcml entry:

  <browser:page
    for="..content.dx.staff_folder.IDXStaffFolder"
    name="fc-category"
    class=".category.CategoryActionView"
    permission="cmf.ListFolderContents"
  />
  <utility component=".category.CategoryAction"
         provides="plone.app.content.interfaces.IStructureAction"
         name="category" />

And while the functionality works, the button now appears on all folder_content views. I presume because this is a global utility.

I only want to show the extra button on the folder_contents of my custom StaffFolders Type however. I was thinking I should maybe use a local Utility? If so, how should I do this? ( the links on Utilities — Plone Documentation v5.2 seem to be broken)

Or is there a better method to achieve this.

Thanks in advance.

Plone Foundation Code of Conduct