Hi
In my situation creating silple plugin works like a charm :
[PropertyDefinitionTypePlugIn] public class PersonListProperty : PropertyList<Person> { }
I am using epi in ver 11.2.1.0.
Same problem here.
Any solutions?
string-property works. But not Url-property...
Finally!
First: We dont need PropertyListBase<T>.
Second (the real solution):
[JsonProperty] [JsonConverter(typeof(UrlConverter))] [Display(Name = "Links", Order = 400)] public virtual Url UrlLink { get; set; }
UrlConverter:
using EPiServer.Cms.Shell.Json.Internal;
Hi Valina,
I think there was nothing tricky to setup PropertyList with XHTML field, simply just add property
public XhtmlString Content { get; set; }
I only remember there was an issue with layout, when you have opened popup window to add/edit an item, but easily possible to fix with some CSS tweaking, see here
Surely there must be a better way to be able to use a Url property in a property list without having to use an internal API which might break or change at any moment?
That's what I was trying to do, but every time I add an xhtml string the property list isn't loading at all, or the property list is jsut appearing blank and I'm unable to edit anything.
If i make it a general string, it works fine (But this wont work)
I just updated to 11.4 and am still having this issue.
Apprently it is throwing an exception when I try to make an xhtml string: Unable to load /EPiServer/shell/Stores/metadata/ep…lock2?dojo.preventCache=1522853523782 status: 500
The stack trace of this exception is:
[ArgumentNullException: Value cannot be null. Parameter name: subject]
EPiServer.RuntimeModelExtensions.GetOriginalType(Object subject) +107 EPiServer.Cms.TinyMce.Core.TinyMceConfiguration.Get(T model, String propertyName) +13 EPiServer.Cms.TinyMce.Core.XhtmlStringEditorDescriptor.ModifyMetadata(ExtendedMetadata metadata, IEnumerable`1 attributes) +109 EPiServer.Shell.ObjectEditing.ExtensibleMetadataProvider.ApplyExtendersToMetadata(ExtendedMetadata metadata, IEnumerable`1 attributes, IEnumerable`1 metadataHandlers) +97 EPiServer.Shell.ObjectEditing.ExtensibleMetadataProvider.CreateMetadata(IEnumerable`1 attributes, Type containerType, Func`1 modelAccessor, Type modelType, String propertyName) +411
I wonder if this has something to do with the new TinyMCE implimentation.
Hi Grzegorz,
Thanks for the reply.
The code is pretty simple and straightforward for property lists, so I don't know what could be going on
public class AccordionBlock2 { public string Headline { get; set; } public XhtmlString Body { get; set; } }
[Display( Name = "Accordion Items 2", Description = "Accordion Items 2", GroupName = SystemTabNames.Content, Order = 10)] [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<AccordionBlock2>))] public virtual IList<AccordionBlock2> AccordionItems2 { get; set; }
public class AccordionPropertyDefinition { [PropertyDefinitionTypePlugIn] public class AccordionProperty : PropertyListBase<AccordionBlock2> { } }
Thank you for those blog posts!! I was working on the TinyMCE 2.0.0 and what you posted has been really helpful!
Thanks again,
The PropertyList<T> as most of you would know is based on JSON-serialization. But it may not be as obvious that the JSON representation is used in three different places; communication between client and server, in the database, and as the export format. These different cases sometimes come with slightly different requirements, which is especially true when it comes to XhtmlStrings and URLs. Features such as permanent links, link tracking and cross-package link support require custom and sometimes complex JsonConvert implementations.
So be aware that even if you can get the UI to work there may be other areas that are not fully functional.
When we updated PropertyList<T> for CMS 11 we unfortunately didn't have time to add support for these features for XhtmlStrings and URLs as we focused on getting the experience right for simple properties first.
So if you want support for a URL property on your list items and use the UrlConverter in the EPiServer.Cms.Shell.Json.Internal, you should know that it was written to only support the client/server use case and that it doesn't have any support for the other features that a URL property on a content item support.
And if you want XhtmlString support my recommendation at this time would be to drop the PropertyList<T> and use blocks and content areas instead unless you are feeling up for a challenge.
Side note: if you also want support for adding default property values in the Admin UI, you have to override the ParseItem method on your PropertyList and make sure that it can parse the format that the ToString method of the list item type outputs. We removed the requirement to implement this method in CMS 11 as most implementations got it wrong anyway.
Hi Valina,
You could try to get rid of using PropertyListBase since you are already running version 11.4 your class might be something like
[PropertyDefinitionTypePlugIn] public class AccordionProperty : PropertyList<AccordionBlock2> { }
Check also that thread about loosing data in PropertyList and fix made in release 208 regarding that bug
Thank you for the clarification Henrik
I went ahead and used the blocks within blocks to get these accordions to work. While not the best way of solving this problem it works and I don't have to spend more time on this. I'll wait until xhtmlstrings are offically supporting as to not break things more in the futre :) I'm pretty good at breaking things as it is, so I don't need more help with that!
Hi,
I have the below code
This code was working fine without any issues in EPiServer 10.10.4 version.
However after upgrading to EPiServer 11, the URL property data is not saving any data and throwing an exception. The Breaking changes telling that to use JsonConverter. Could you please tell me how to use JsonConverter to the existing propertylist and what should be done in the PropertyListbase to save Url property data.