Skip to content

Setup: Properties display

dante di domenico edited this page Jan 9, 2025 · 21 revisions

Edit configuration

Properties display can be set by Properties configuration in config/app_local.php (or in config/projects/<projectName>.php if you use multi project configuration).

You can also override it directly in your BEdita Manager, at Admin -> Appearence page, in json format.

Each key represents a module. I.e.:

'Properties' => [
    'documents' => [
        // ...
    ],
    'events' => [
        // ...
    ],
    'images' => [
        // ...
    ],
],

Each module can have setup for index, view, relations, filter, bulk, fastCreate.

index

'index' properties to display in index view (other than id, status and modified, always displayed if set). I.e.:

'Properties' => [
    'documents' => [
        'index' => [
            'title',
            'description',
        ],
    ],
],

options

You can customize properties in form using options group. You can specify, by property name, the label you want to see, the type and readonly value (true or false). I.e.:

'Properties' => [
    'documents' => [
        'options' => [
            'description' => [
                'label' => 'D E S C R I P T I O N',
                'type' => 'plaintext', // can be plaintext, richtext, email, uri, json, date-time, date, checkbox, enum
                'readonly' => true,
            ],
            'body' => [
                'type' => 'plaintext',
            ],
        ],
    ],
],

view

_keep

'_keep' is a special group of properties to keep and display even if not found in object. I.e.:

'Properties' => [
    'users' => [
        'view' => [
            '_keep' => [
                'password',
                'confirm-password',
            ],
        ],
    ],
],

_hide

'_hide' is a special group of properties to hide fields from display groups. I.e.:

'Properties' => [
    'users' => [
        'view' => [
            '_hide' => [
                'fieldname',
            ],
        ],
    ],
],

Fields specified in _hide won't be displayed in module view.

core

Put in 'core' the properties you want to always be open on the top of the view of your module. You can also set an element to be included in "core" section. I.e.:

'Properties' => [
    'documents' => [
        'view' => [
            'core' => [
                '_element' => 'MyPlugin.Form/documents_view_core',
                'title',
                'description',
            ],
        ],
    ],
],

publish

'publish' is used to group fields publishing related. Fields will be in publish-properties area in the view. I.e.:

'Properties' => [
    'documents' => [
        'view' => [
            'publish' => [
                'uname',
                'status',
                'publish_start',
                'publish_end',
            ],
        ],
    ],
],

advanced

'advanced' fields can be set in this confit. You can also include a custom element from another plugin, i.e:

'Properties' => [
    'documents' => [
        'view' => [
            'advanced' => [
                 // Use custom element in `MyPlugin` to display this group
                 '_element' => 'MyPlugin/advanced',
                 'extra_field',
            ],
        ],
    ],
],

other

'other' section contains all "remaining attributes" not in other sections, or the fields you set. I.e.:

'Properties' => [
    'documents' => [
        'view' => [
            'other' => [
                 'body',
            ],
        ],
    ],
],

custom

Custom name can be added as key, like 'my_group' or 'some_info' => a tab named My Group or Some Info will be generated inside any of the groups above an optional '_element' can define a custom view element for this group. I.e.:

'Properties' => [
    'users' => [
        'view' => [
            'personal data' => [
                'person_title',
                'gender',
                'birthdate',
                'vat_number',
            ],
            'contact info' => [
                'phone2',
                'email2',
                'website',
                'street_address',
                'city',
                'zipcode',
                'country',
                'state_name',
                'delivery_address',
            ],
        ],
    ],
],

relations

Relations ordering by relation name. Optional keys: 'main', 'aside', '_element', '_hide', '_readonly'.

Set in 'main' first relations to show on main column, other relations will be appended. Set in 'aside' relations to show on right aside column. Set in '_element' custom template path per relation. Set in '_hide' relations to hide'. Set in '_readonly' relations to show in readonly mode'.

An example:

'Properties' => [
    'events' => [
        'relations' => [
            'main' => [
                'poster',
                'has_location',
            ],
            'aside' => [
                'seealso',
            ],
            '_element' => [
                'poster' => 'MyPlugin.Form/posters',
                'has_location' => 'MyPlugin.Form/locations',
            ],
            '_hide' => [
                'has_links',
            ],
            '_readonly' => [
                'part_of',
            ],
        ],
    ],
],

filter

Set 'filter' for filters to display. I.e.:

'Properties' => [
    'users' => [
        'filter' => [
            'status',
            'roles',
        ],
    ],
],

bulk

Bulk actions fields. I.e.:

'Properties' => [
    'documents' => [
        'bulk' => [
            'status',
            'Change language' => 'lang',
        ],
    ],
],

fastCreate

Fast create form config is used in side panel, when adding objects to a relation. You can customize fields by module: 'required' to set fields that cannot be left empty, 'all' for all fields to show in form. I.e.:

'Properties'
    'links' => [
        'fastCreate' => [
            'required' => ['status', 'url'],
            'all' => ['status', 'url', 'title', 'description'],
        ],
    ],
],