Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to extend page default fields #191

Closed
Mikearaya opened this issue May 22, 2024 · 2 comments
Closed

Option to extend page default fields #191

Mikearaya opened this issue May 22, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Mikearaya
Copy link

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 []
@aheinze
Copy link
Collaborator

aheinze commented May 24, 2024

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 aheinze added the enhancement New feature or request label May 31, 2024
@Mikearaya
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants