Cockpit-HQ / Cockpit

Cockpit Core - Content Platform
https://getcockpit.com
Other
388 stars 47 forks source link

Option to extend page default fields #191

Closed Mikearaya closed 5 months ago

Mikearaya commented 6 months ago

Currently, a page whether it a layout, collection, or singleton has only a few default inputs

is there a configuration to extend the default inputs either per page bases or globally that will enable us to add additional fields for example change it to:

aheinze commented 6 months ago

In your config/bootsrap.php:

<?php

$app->on('pages.pagetype', function($types) {

    $data = $types['layout']['data'];

    $types['layout']['data'] = function() use ($data) {

        return array_merge([
            [
                'name' => 'subtitle',
                'type' => 'text',
            ]
        ], $data());
    };

});
Mikearaya commented 5 months ago

thanks