Download the PHP package hananils/kirby-choices without Composer

On this page you can find all versions of the php package hananils/kirby-choices. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package kirby-choices

Choices offers methods to resolve selections stored by select, multiselect or checkboxes fields back to their human-readable values. It also gives access to the full list of options defined in the blueprint, either written statically or loaded via query or api settings.

Introduction

Choices’ primary usecase is outputting selections and field options on the frontend. For instance, you can use it to show categories and tags or to create classes and data attributes from a selection. It can also be used to resolve selections in info or help texts inside of panel sections.

Choices is used as shared term for both selection and option lists.

The plugin creates a collection of all choices and allows you to evaluate, manipulate and convert them on the fly.

Field method

$field->toChoices($all, $context)

Given a field with options, this class retrieves all choices made by the editors or – if the all parameter is set – of all options defined for this field.

In case of nested fields, e. g. when used inside a structure field, the name of the parent field must be passed as context in order to retrieve the choices.

Choices extends the default Kirby Collection class and thus offers all methods known from other Kirby object like first(), last(), shuffle(), sort() and the like.

Basic examples

Given a select field with fruits, either return the selected or all available options in human readable format.

Field

Content

Output the selected options

Output all available options

Out the selected options as comma-separated list

[!TIP] See the manipulation guides to learn how to use Kirby’s string methods on all choices before output. There are also methods to evaluate the existence or non-existence of a choice and further options to convert content to another type – for instance, switching between text and value output.

Installation

By default, plugins in Kirby reside in a special folder located at /site/plugins. Each plugin is installed in its proprietary subfolder. This installation can be handled in four different ways: you can either install them manually or manage them using Kirby CLI, Git submodules or Composer. You can install Choices either way and should choose the method suiting your project best.

Please note that all examples given here assume you are using the default plugin root. If you changed your plugin root, e. g. with a custom folder setup, you’ll also have to adjust the paths given in this guide. For further information on how to manage plugins, please read the official Kirby plugin introduction.

Download

Download and copy this repository to /site/plugins/choices.

Kirby CLI

Git submodule

Composer

Documentation

Where possible, files contain inline annotations. For extended documentation, please visit our dedicated plugin site at kirby.hananils.de/​plugins/​choices.

Guides

Reference

License

This plugin is provided freely under the MIT license by hana+nils · Büro für Gestaltung. We create visual designs for digital and analog media.


All versions of kirby-choices with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
getkirby/composer-installer Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hananils/kirby-choices contains the following files

Loading the files please wait ...