-
Hi everyone, I'm doing some tests on custom content fields, and I have created a module (feature) for my content fields, that contains a I noticed that when I add my custom content field to a Content Type, I can click on the edit button, as shown in this screenshot: And a settings page is displayed (URL path: https://localhost:7825/Admin/ContentParts/Index/Fields/MyText/Edit?returnUrl=%2FAdmin%2FContentTypes%2FEdit%2FIndex): But, when adding breakpoints in my What I'm attempting to do is add a string property to my custom field, this string property will contains a regex. This will serve as a validation method when the Admin user fills out the field and submits it to the Of course, I know that I can also add a regex validation using a custom editor (we already discussed this topic here), but my goal is to explore whether I can achieve the same outcome with a custom validation attribute. I'm treating this as an experiment. Thank you for your help 😊 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I checked the source code and found the "Edit page" in the backoffice, specifically the |
Beta Was this translation helpful? Give feedback.
-
@hishamco apologies for the direct mention. I noticed that you contributed to the Content Types documentation page, and I thought you might have a suggestion regarding the question I asked above. Do you have any insights? 🙂 Thank you |
Beta Was this translation helpful? Give feedback.
-
You would need a settings driver for that. Which is different from the Field display driver. You will have a class that inherits from The |
Beta Was this translation helpful? Give feedback.
You would need a settings driver for that. Which is different from the Field display driver. You will have a class that inherits from
ContentPartFieldDefinitionDisplayDriver
. Something likepublic class MyTextFieldSettingsDriver : ContentPartFieldDefinitionDisplayDriver<MyTextField>
which is then added to yourStartup.cs
with something likeservices.AddScoped<IContentPartFieldDefinitionDisplayDriver, MyTextFieldSettingsDriver>();
. You will have to add your view and such too, but this should get you in the right direction and give you something to search for.The
ContentFieldDisplayDriver
is for handling the displaying on the front end and editing of the content item itself, not the editin…