Cockpit icon indicating copy to clipboard operation
Cockpit copied to clipboard

Option to extend page default fields

Open Mikearaya opened this issue 1 year ago • 1 comments

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

  • title
  • slug
  • SEO {} -layout components []

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:

  • title
  • subtitle
  • slug
  • SEO {} -layout components []

Mikearaya avatar May 22 '24 20:05 Mikearaya

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());
    };

});

aheinze avatar May 24 '24 00:05 aheinze

thanks

Mikearaya avatar May 31 '24 10:05 Mikearaya