Buttons 8: Connect frontend with view button classes #6546
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Panel\Ui
component classes #6539k-view-button
component #6540buttons
extension #6541k-view-button
for view buttons #6543Summary of changes
Panel\Model
classesChangelog
Features
Docs
As with the previous PR, view buttons can be defined by names in a model blueprint or for all views in the config.
Define custom button in config
However, one can now even define whole buttons by setting an array instead of a name string. The array consist of a
component
key (optional, if omittedk-view-button
will be used) and aprops
array.Via config:
Shorthand for only props
If you don't pass a component-props definition, you can also just pass the props on their own, being then applied to
k-view-button
:Define custom button in a blueprint
This also works in blueprints:
Reusable buttons: Panel area buttons extension
If you do not want to define just one button via the config, but reuse it (or even ship it as part of your plugin), you have to add them to the Panel area extension:
You have the same options for your return value: full component-props array or just props on top-level. In addition, you can also return directly a
Kirby\Panel\Ui\Button\ViewButton
object.See
Kirby\Panel\Ui\Button\ViewButton
properties for availableprops
options (also for array notation).Ready?
For review team