Download the PHP package maxime-rainville/anyfield without Composer

On this page you can find all versions of the php package maxime-rainville/anyfield. 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 anyfield

Silverstripe CMS AnyField module

This module provides two simple form fields to manage has-one and has-many relations for a parent record.

AnyField and ManyAnyField are best suited to managing simple DataObjects that are tightly coupled to their owner. This module will not work well for DataObjects with complex relations.

silverstripe/linkfield is a great complement to the AnyField.

Installation

This module require Silverstripe CMS 5 or greater.

Showcase

Quick demo

Sample usage

Customising how DataObject look in the field

Any DataObject can be managed by the AnyField and ManyAnyField without any special tweaks. However, you can get a bit more value with some simple tweaks. Those tweaks can be applied with DataExtension.

Customising the Title

The AnyFields displays the selected DataObject title. By defining a getTitle method for DataObject class, you can customise the title displayed in the field.

Showing a summary

The AnyFields displays the type of the selected DataObject below its title. You can also display a summary by implementing a getSummary method on your DataObject class. This can be done with a DataExtension as well.

Showing an icon

You can customise the icon to display for each class of DataObject by defining a private static $icon config value for your DataObject.

Silverstripe CMS comes with some predefined icons you can use. Alternatively, the icon value will be add as a CSS class to the relevant button which you can then target with your own custom icon.

Sorting the ManyManyField

ManyManyField can be configured to sort its results. Called setSort to define what field should be used to sort the results

A convenience extension can be applied to your DataObject classes to add the required field to make them sortable. The extension will automatically add a Sort integer field, define the default sort order and hide the Sort field from the CMS form.

Advanced use case

Auto-publishing and cascade deleting

The AnyFields doesn't allow you to publish or delete child DataObjects independently from their owner. To avoid orphan objects or unpublished DataObject, you should explicitly define ownership and cascade rules on the owner DataObject class.

Controlling what DataObject class can be created via the AnyFields

AnyField and ManyAnyField try to automatically detect what DataObject classes they are meant to manage by looking up the matching relations on their parent object.

If you decide to name the AnyFields something other than its intended relation, you'll have to explicitly tell it what DataObject class to use.

By the default, the AnyField automatically discovers any sub classes of the base class and allows the end user to create those sub classes. You can turn off this behaviour by calling setRecursivelyAddChildClass.

You can also exclude individual classes as well.


All versions of anyfield with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
silverstripe/framework Version ^5
silverstripe/admin Version ^2
league/uri Version ^7.1
league/uri-components Version ^7.1
maxime-rainville/silverstripe-react Version ^0.1
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 maxime-rainville/anyfield contains the following files

Loading the files please wait ....