PHP code example of superbig / craft3-collections
1. Go to this page and download the library: Download superbig/craft3-collections library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
superbig / craft3-collections example snippets
return [
/** Add your macros here
* "macros" => [
* 'toUpper' => function () {
* return $this->map(function ($value) {
* return strtoupper($value);
* });
* },
* ],
*
*/
"macros" => [
],
];
return [
'macros' => [
'tagGroups' => function () {
return $this->groupBy(function ($tag) {
return substr($tag->title, 0, 1);
});
}
],
];