Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Content Fields #15

Closed
cliftonc opened this issue May 20, 2011 · 6 comments
Closed

Content Fields #15

cliftonc opened this issue May 20, 2011 · 6 comments
Labels
Milestone

Comments

@cliftonc
Copy link
Owner

Ability to add any fields to content based on content type. This could be configured in the content type, and initially provided as a JSON structure that describes the fields (as per a mongoose schema). This should be possible to do quite dynamically as any structure can be appended to the 'meta' object (and newer versions of mongoose allow for more dynamic schemas).

@cliftonc
Copy link
Owner Author

This is now in the master branch. Will write a blog post with an example, but allows (almost) complete over riding of fields on content by content type, including addition of sections and removal (e.g. hiding) of the default fields. Has limited usability but it demonstrates that it works.

e.g. add the following to Article fields (edit the content type):

{"fields":[
   {"name":"content[yourField]","type":"text","label":"Your Field","description":"Hello"},
   {"name":"content[scheduled]","hide":true}
],
"sections":[
  {"id":"form-section-category","hide":true},
  {"id":"form-section-blah","label":"My Section",
"fields":[
   {"name":"content[anotherField]","type":"text","label":"Another Field","description":"Hello"}
]}
]}

This will, add a field called 'yourField', hide the field 'scheduled', hide the section with ID 'form-section-category' and add a section with a field. All of this will be saved / loaded from Mongo for this content type.

If you haven't dug into Calipso yet, this is all based on the Forms API outlined in CalipsoForm.

@Charuru
Copy link

Charuru commented Jun 16, 2011

Hi will this have out of the box support for multiple field items?

@cliftonc
Copy link
Owner Author

Yes, you can add as many field items as you like - there is no limit. The 'fields' array can have as many items as you like in it.

@Charuru
Copy link

Charuru commented Jun 16, 2011

Sorry just to clarify one more time, I mean multiple values.

Such as Authors: [Bob, John, Jane]

@cliftonc
Copy link
Owner Author

Yes, the form api lets you create any form field, e.g.

{label:'Select Field',name:'object[select]',type:'select',options:["option 1","option 2"],description:'Description...'},

The options field can also be a synchronous function calll (in the case the options need to be more dynamic).

HTH

Clifton

@cliftonc
Copy link
Owner Author

Best to take a look at this: http://calip.so/dox/library/Form

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants