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

Default value on file collection string field fails #4363

Closed
mikestopcontinues opened this issue Sep 24, 2020 · 3 comments
Closed

Default value on file collection string field fails #4363

mikestopcontinues opened this issue Sep 24, 2020 · 3 comments

Comments

@mikestopcontinues
Copy link

Describe the bug

I have a string field with a default value on a file in a file collection that doesn't get populated, while an identical config works in a folder collection.

To Reproduce

{
collections: [{
  name: 'main',
  label: 'Main Pages',
  singular_label: 'Page',
  preview_path: '{{fields.slug}}',
  format: 'yaml-frontmatter',
  editor: {preview: false},
  create: false,
  delete: false,
  files: [{
    label: 'Home',
    name: 'home',
    file: `content/page/home.md`,
    fields: [
      {label: 'Title', name: 'title', widget: 'string', default: 'Home'},
    ],
  }],
}]
}

Expected behavior

I expect the default value to apply.

Applicable Versions:

Most recent everything.

Additional context

I'm manually initializing, and doing my config in JS.

@mikestopcontinues mikestopcontinues added the type: bug code to address defects in shipped code label Sep 24, 2020
@tomrutgers
Copy link
Contributor

A bit of background as to why this isn't working: The default value of a widget is only set upon creation and as a file in a file collection isn't created through the CMS, the default value can't be set. Default values only work with folder collections.

@mikestopcontinues
Copy link
Author

Maybe a good solution is to have the CMS create the files in a file collection? It's a bit of a pain that it doesn't anyway.

@tomrutgers tomrutgers removed the type: bug code to address defects in shipped code label Sep 28, 2020
@martinjagodic
Copy link
Member

File collection not creating files is intentional. Closing as not planned.

@martinjagodic martinjagodic closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants