Skip to content

The Categories

The groups mentioned in the previous page are grouped into categories.

The order of categories defined in the backend will be preserved in the frontend.

Here is an example of a complete trio definition for a simple module:

php
namespace App\Services\App\Module\Specific\Locus;

class LocusInitDetails  implements InitDetailsInterface
{
    public static function modelGroups(): array
    {
        return [
            'Season' => [
                'code' => 'FO',
                'source' => ['module' => 'Season', 'field' => 'id'],
                'field_name' => 'season_id',
                'manipulator' => function ($val) {
                    return (string) ($val + 10);
                },
            ],
            'Area' => [
                'code' => 'FO',
                'source' => ['module' => 'Area', 'field' => 'id'],
                'field_name' => 'area_id',
            ],
            'Search-Description' => [
                'label' => 'Search-Description',
                'code' => 'SF',
                'field_name' => 'description',
            ],
            'Square' => [
                'code' => 'TM',
                'dependency' => [],
                'multiple' => true,
            ],
            'Locus Type' => [
                'code' => 'TM',
                'dependency' => [],
                'multiple' => true,
            ],
            'Order By' => [
                'code' => 'OB',
                'options' => ['Season', 'Area', 'Locus No.'],
            ],
        ];
    }

    public static function categories(): array
    {
        return [
            'Search' => [
                'Search-Description',
            ],
            'Registration' => [
                'Season',
                'Area',
                'Media',
                'Square',
            ],
            'Description' => [
                'Locus Type'
            ],
            'Order By' => [
                'Order By',
            ],
        ];
    }
}

WARNING

Dependent Groups (and Categories) should always be placed after their dependecies!