Download the PHP package rasteiner/k3-whenquery without Composer

On this page you can find all versions of the php package rasteiner/k3-whenquery. 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 k3-whenquery

k3-whenquery

Conditionally show fields and sections. Better.

Installation

Download

Download and copy this repository to /site/plugins/k3-whenquery.

Git submodule

Composer

Use

Add a whenQuery property to your fields and sections. The expression in this query will be evaluated in real time in the browser to hide the section or field when it evaluates to a falsy value.

Expression Language Syntax

There are no assignments and function calls (it's meant to be as harmless as possible). Since there are no assignments, = is an equality comparison (there is no ==).

Supported operators

Member Access is always "optional": it does never throw an error if you access a property of undefined; it just evaluates to undefined. In short, . behaves like javascript's ?. and a[something] behaves like a?.[something].

The search operator =~ is a multifunction tool: it behaves differently depending on the type of its operands:

There's also support for String, Number, Boolean (true, false), Object and Array literals.

Array operators

General syntax:

Array operators are made of 3 parts:

  1. In the left the array they operate on
  2. after :: the name of the operation
  3. between the parentheses the expression that is evaluated for each array item.

Inside of the parentheses, the symbol $ represents the "current" item.

Example

Array reducers

Array reducers are functions that take an array and return a single value. They can be used to aggregate values in an array. The syntax is similar to the array operators, but ::reduce(expr, ?initial) accepts an optional initial value. If no initial value is provided, the first item of the array is used. Inside of the parentheses, the symbol $ represents the "current" item, while $1 represents the return value of the "previous" iteration (aka the "accumulator"). The array is always traversed left to right.

Example

An example usage without an initial value:

Variables lookup

Content variables

By default, any valid identifier refers to the "current" fieldset. This means that page fields could be shadowed by other fields with the same name in a structure or block, when the query is executed in such structure or block. If no field is found in the current fieldset, the query is evaluated in the page fields.

Model variables

The Site, Pages, Files and Users are "models". Other than content, they also have other properties that might be useful in a query. These properties are accessible by prepending an underscore (_) to their name, when (and only when) the query is being executed inside of their respective View.

The accessible Site properties are:

The accessible Page properties are:

The accessible User properties are:

The accessible File properties are:

Example

Known issues


All versions of k3-whenquery with dependencies

PHP Build Version
Package Version
Requires getkirby/composer-installer Version ^1.2
getkirby/cms Version >=3.8
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 rasteiner/k3-whenquery contains the following files

Loading the files please wait ...