Download the PHP package hananils/kirby-link-methods without Composer
On this page you can find all versions of the php package hananils/kirby-link-methods. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hananils/kirby-link-methods
More information about hananils/kirby-link-methods
Files in hananils/kirby-link-methods
Package kirby-link-methods
Short Description Methods to convert Kirby objects to natural comma-speparated lists
License MIT
Informations about the package kirby-link-methods
List Methods is a plugin for Kirby 3 providing methods to generate comma-separated list from collections like pages, users or files. It allows for custom field selection for the list value, optional conjunctions for the last item (e. g. "and") and custom links for each item that can be defined using Kirby's query language (e. g. {{page.url}}
). It also provides specific methods to list numeric values like years, shortening ranges for better readability.
Installation
Download
Download and copy this repository to /site/plugins/list-methods
.
Git submodule
Composer
Pages, Users and File Methods
There are different options to create lists from users, pages or files collections:
Comma-separated list using the primary field
Creates a list separated all items with a comma:
Creates a list of years:
Comma-separated list using a custom field or method
Creates a list separated all items with a comma:
Comma-separated list using a conjunction
Creates a list separated all items with a comma but the last which is connected with a cunjunction:
The default conjunction and
is provided in English or German depending on your language settings.
Comma-separated list with dynamic links
Creates a list linking to a custom destination:
You can use Kirby's template syntax with query language to fetch any information from the current context, e. g. the current $user
, $page
or $file
object. The $kirby
and $site
objects are also available.
Content methods
When dealing with a single page or user, there are methods to generate lists from content field:
Both methods, asList
and asNumericList
, support setting a custom conjunction via a secondary attribute:
Collection methods
The plugin also features a general, more simple collection method which is a shortcut the naturalList()
helper and only allows for a custom conjunction:
Helper
If you'd like to create a list outside of the Kirby objects, from an array for instance, you can use the naturalList()
helper. It accepts a flat array and a conjunction, there is no custom key selection or template syntax support:
If you are handling numeric values, you can use the numericList()
helper:
License
This plugin is provided freely under the hana+nils · Büro für Gestaltung. We create visual designs for digital and analog media.