Sorry, we don't support your browser.  Install a modern browser
This post is closed.

New field: Button

I often use the Janitor plugin (https://getkirby.com/plugins/bnomei/janitor) to add button in my panels project and trigger different actions like: redirect to another page, reload the current page, generate a PDF or CSV file, run a php script or cronjob …

I think such a field is missing in Kirby and very very usefull … I need it in almost all my projects.

5 years ago
2

@Gillesvauvarin I do agree that a button field would be very useful. At the same time I am a bit afraid of the broad funcitonalities that could happen when the button is clicked – Janitor covers them vastly. But I’d think this would be too much for the core.

Maybe collecting the most common use cases and corresponding blueprint syntax would move this ahead.

3 years ago

The most common use cases for me are :

  • Redirect to an URL (to execute a PHP script)
  • Reload the current panel page
3 years ago

v6 will include a new buttons field that allows to render one or many <k-button> with adapted styling. Currently, this allows to open a link, a dialog or a drawer. But not yet sending requests. I have an experiment already for adding a request prop to k-button. However, this opens up a number of questions (e.g. how to display the result of the request).

a year ago
1

Very interesting! Do you perhaps have an example in YAML of what it might look like if you wanted to open a drawer with the button? For example, even just with simple text or query language. Can this then be defined completely in the blueprint? Something like:

button:
  type: button
  target: drawer
  content: 'Need help, call {​{​site.phoneNumber}}'
a year ago

No not quite, it will be based on the Panele extensions, e.g. defining your custom dialig (https://getkirby.com/docs/reference/plugins/extensions/panel-dialogs#dialog-definition__load-callback) and then referecing the route/endpoint in the blueprint:

myButtons:
  type: buttons
  buttons:
    - text: Open dialog
      dialog: my/dialog/route
a year ago

Ah, okay, understandable, but of course very sad! Perhaps it would be an option to check whether dialog is a route or contains a / and, if not, simply output a text? It would sometimes be very useful to better hide long help texts on a page. Same could be easily done with dialog or drawer

a year ago
Changed the status to
Completed
11 days ago