Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Is there a way to get the htmlFieldPrefix in widget.edit #5995

Closed
SteeveDumais opened this issue Apr 20, 2020 · 8 comments
Closed

Is there a way to get the htmlFieldPrefix in widget.edit #5995

SteeveDumais opened this issue Apr 20, 2020 · 8 comments
Milestone

Comments

@SteeveDumais
Copy link

I am trying to get the html prefix of a widget so that I can manually create the field in Widget-{myWidget}.edit.cshtml.

All my widgets will be in react and I need to name them correctly so that the ModelUpdate will pick up the modification in edit mode.

@ns8482e
Copy link
Contributor

ns8482e commented Apr 21, 2020

@SteeveDumais For example, If your widget is called News create template with Content-News.Edit.cshtml

@SteeveDumais
Copy link
Author

I have created the file Content-{MyWidget}.edit.cshtml but it is not being hit. Is there no way to get the value on the widget.edit.cshtml page?

@ns8482e
Copy link
Contributor

ns8482e commented Apr 22, 2020

Hmm! So If your Content Type News has Stereotype Widget then It will take Widget-News.Edit.cshtml. But if stereotype is blank then it will take Content-News.Edit.cshtml

ShapeTable is created at start of the application, so if you add new shapes in Views folder, you may need to restart the application.

@SteeveDumais
Copy link
Author

Where in the model is the prefixe when I go to Widget-News.Edit.cshtml. I have modified the ContentCard-FlowPart.Edit.cshtml to force the Model.ContentEditor.Metadata.Prefix = Model.PrefixValue. I was hoping that I did not have to do that step and that Model.ContentEditor had that value somewhere or it was present int he viewContext

@ns8482e
Copy link
Contributor

ns8482e commented Apr 22, 2020

@SteeveDumais I don't think that you need to change the prefix value.
Can you explain what you are trying to achieve?

@SteeveDumais
Copy link
Author

I am creating a contentCard that has a Content of stereotype widget. When I display the widget it is a react component. In order for the values to be saved the widget components need to be named "prefixValue. the field name", where the prefixValue is coming from the contentCard. I was hoping there was a way to reference the contentCard prefix in the widget-myWidget.Edit.cshtml page

@ns8482e
Copy link
Contributor

ns8482e commented Apr 22, 2020

@SteeveDumais when you use Widget-{contenttype}.Edit.cshtml, the Model is an editor ZoneHolding shape of your content type . You can access fields and parts using Model.Content or Model.Parts shapes.

@sebastienros sebastienros added this to the backlog milestone Apr 30, 2020
@ns8482e
Copy link
Contributor

ns8482e commented May 8, 2020

@SteeveDumais with recent change in PR #5989 , now, PrefixValue is ContentItemId for existing Item.

@OrchardCMS OrchardCMS locked and limited conversation to collaborators Apr 25, 2024
@Piedone Piedone converted this issue into discussion #15860 Apr 25, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants