Buttons in Singeltons


#1

Hello, one Question Exist a Addon to Create Buttons in Singeltons, to Start a Get or Post Request for the Curl of a Page ? Like the Webhooks internal but, you can Start it.

On the Time i made this over the Clear Cache Button in Settings, it’s the Same i will clean the Generate Staticpages in my PHP Frontend.

Any idea?

Thanks for your Help


#2

@fschuermeyer, you can’t (at least directly), but if what you want is to trigger an external action, you can use the following approach:

  1. Create a singleton named releases (you don’t need any fields but you can have a title and description)
  2. Implement a singleton.saveData.after.releases hook and inside it do the curl request you need (this hook is triggered every time the singleton releases is saved)

There are also other options (a custom field type, add the button using Javascript only).

I faced similar situation for Netlify and ended up by implementing a custom addon - https://github.com/pauloamgomes/CockpitCMS-Netlify


#3

Hay,
i create now a “Command line” with differnet Commands to do this over the action hook :slight_smile:
And i change the form from Singeltons if the Name from Singelton is Command Line :slight_smile:
This works very Good