Download the PHP package bigfork/supergroupedlist without Composer
On this page you can find all versions of the php package bigfork/supergroupedlist. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bigfork/supergroupedlist
More information about bigfork/supergroupedlist
Files in bigfork/supergroupedlist
Package supergroupedlist
Short Description An extension of SilverStripe’s GroupedList that supports traversing relations
License BSD-3-Clause
Homepage https://github.com/bigfork/supergroupedlist
Informations about the package supergroupedlist
SuperGroupedList
An extension of SilverStripe’s GroupedList that supports traversing relations.
Note: depending on your data, the same items may be output multiple times. For example if a product belongs to multiple categories, and you group by category title, then the product will show under each of the categories that it belongs to.
Installation
Or download and extract to a folder named supergroupedlist
in your document root.
Usage
Use exactly as you would use GroupedList
, but with dot-notation to traverse relations:
You can traverse has_one
, has_many
and many_many
relations using dot notation. The last part of the notation you provide (Title
in the example above) will be both the field that’s extracted from the final component, and the $Variable
used to access that field inside the loop.
You can even traverse multiple relations at once. For example, $GroupedProducts.GroupedBy('Manufacturer.Employees.FavouriteTeam.Name')
would return a list of products grouped by the names of the favourite teams of the employees of the product’s manufacturer.