-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Before using the plugin, please set appropriate options in site/config/config.php
:
<?php
return [
'lukasbestle.downloads' => [
// Path to the page where all downloads are stored;
// REQUIRED
'path' => 'downloads',
// Associative array of fields that can be used as filters in
// the block with field name and label (optionally localized);
// defaults to none (only manual selection of files)
'fields' => null, // e.g. `['content.product' => 'Relevant product']`
// Number of downloads to list per pagination page;
// can be set to `null` to disable pagination
'paginate' => 15,
// File template of the download files inside the `path`;
// defaults to any template
'template' => null, // e.g. `'download'`
]
];
These options control which files can be selected and/or filtered as downloads in any Downloads block throughout the site.
This option allows you to define which fields can be used as filters both inside the block and in the frontend user interface.
The key of each element is a Kirby query that operates on each File
object. E.g. you can use content.product
to access a content field, extension
to call a file method directly or even content.tags.split(",")
to use field methods.
The value of each element defines the labels that will be used for the field and its options in the Panel and in the frontend user interface. The following syntaxes are supported:
- A string like
'Relevant product'
to define a fixed label for the field - An array with
label
andoptions
keys, optionally with translations for different languages:
[
// fixed label of the field itself...
'label' => 'Relevant product',
// ...optionally with translations
'label' => [
'en' => 'Relevant product',
'de' => 'Relevantes Produkt'
],
// labels for each of the options;
// options that don't exist for any file are ignored
// and missing options automatically fall back to the
// option value
'options' => [
// key: option value
// value: label...
'bowl' => 'Bowl',
// ...optionally translated
'cup' => [
'en' => 'Cup',
'de' => 'Tasse'
]
]
]
If the fields
option is not set at all, filters are completely disabled. It is still possible to use the block with manual file selection and frontend search. This mode can be useful if your downloads don't have elaborate metadata.
You can set this option to any integer to change the number of results per page or set it to null
to disable pagination (all results will be displayed at once).
To use the plugin, you need to enable the block and add styling.