You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Created by: Nate Iler ([email protected]) on 2015/03/11 14:29:14 +0000
Votes at time of UserVoice import: 2
When working with complex forms within front end templates, the methods within FieldType models are limited.
For example, the CategoryFieldType model 'getInputHtml' builds the entire field...from assembling settings to the output html. The field type settings contains a category source, but converting that source 'group:3' into a category group model is done through protected methods.
Another example is the RichTextFieldType. The 'getInputHtml' method does so much that can't be utilized on the front end...loads config js, parses refs, page breaks, etc and then builds the input element.
My initial thought would be to introduce public methods along these lines:
getInputSettings
prepInputValue
includeInputResources
renderInputTemplate
The idea is to share and separate duties between the admin panel and front end templates.
getInputSettings would produce settings that are prepped and shared between the admin panel and front end templates.
prepInputValue would prep an input value for use (like RichTextFieldType).
includeInputResources is where the admin resources could be defined. These would not be automatically included as they are now when called 'getInputHtml'
renderInputTemplate could be defined independently to the admin templates or front end templates
At the end of the day, It would be great to have all of the field type data, settings etc that is used to generate field type html in the admin panel on the front end where custom logic, styling and javascript can be used with it.
This discussion was converted from issue #1152 on July 13, 2021 04:02.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When working with complex forms within front end templates, the methods within FieldType models are limited.
For example, the CategoryFieldType model 'getInputHtml' builds the entire field...from assembling settings to the output html. The field type settings contains a category source, but converting that source 'group:3' into a category group model is done through protected methods.
Another example is the RichTextFieldType. The 'getInputHtml' method does so much that can't be utilized on the front end...loads config js, parses refs, page breaks, etc and then builds the input element.
My initial thought would be to introduce public methods along these lines:
The idea is to share and separate duties between the admin panel and front end templates.
getInputSettings would produce settings that are prepped and shared between the admin panel and front end templates.
prepInputValue would prep an input value for use (like RichTextFieldType).
includeInputResources is where the admin resources could be defined. These would not be automatically included as they are now when called 'getInputHtml'
renderInputTemplate could be defined independently to the admin templates or front end templates
At the end of the day, It would be great to have all of the field type data, settings etc that is used to generate field type html in the admin panel on the front end where custom logic, styling and javascript can be used with it.
Beta Was this translation helpful? Give feedback.
All reactions