Download the PHP package hananils/kirby-type-methods without Composer
On this page you can find all versions of the php package hananils/kirby-type-methods. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hananils/kirby-type-methods
More information about hananils/kirby-type-methods
Files in hananils/kirby-type-methods
Package kirby-type-methods
Short Description Type Methods helps to identify the type of an object, either page, user or file, in order to simplify logic in snippets that – for instance – handle content from both $page and $user objects.
License MIT
Homepage https://kirby.hananils.de/plugins/type-methods
Informations about the package kirby-type-methods
Type Methods helps to identify the type of an object, either page, user or file, in order to simplify logic in snippets that – for instance – handle content from both $page and $user objects.
Examples
Think of site where you want to list members. Member information is either stored with the Kirby users (for admins) or on pages (for regular members). Given you have an array of all members, containing either user or page objects, type methods will help you to identify the source:
There is also a shortcut to check the given template or role respectively:
Using isType() is both shorter than checking intendedTemplate or role and also doesn’t require you to check first which object you are dealing with (page or user).
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 Type Methods 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/type-methods.
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/type-methods.
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.