Collection methods are registered with the
They are used for all CMS collections (
Users as well as
Default collection methods
For a full list of default collection methods, please check out the Reference.
Be aware that you cannot override these default collection methods with any custom collection method.
You can extend the set of defined collection methods in a plugin file.
This example shows the basic architecture of a collection method. You define the method name with the key for the
collectionMethods extension array.
$this in the callback function refers to the
The example will return an array of collection item IDs.
Working with method arguments
In some cases it might be helpful to be able to pass arguments to the method.
You can define arguments for a method like this:
And then use it like this:
This example will return the titles of all collection items.