AI OnAI Off
If I understand you correctly... You can actually change how properties are fetched by implementing your own handler for PropertyDataCollection.
The following code will set PageName to be fallback for PageHeading. However, this will be true for all instances of PageHeading on all content types. But that's usually what you want in this case.
[PagePlugIn]
public class PropertyFallbacks
{
private static Hashtable FallbackProperties { get; set; }
public static void Initialize(int optionFlags)
{
PropertyDataCollection.GetHandler = FallbackPropertyHandler;
FallbackProperties = new Hashtable { { "PageHeading", "PageName" } };
}
public static PropertyData FallbackPropertyHandler(string name, PropertyDataCollection properties)
{
var data = properties.Get(name);
if (data != null && (!data.IsNull || data.IsMetaData))
{
return data;
}
var dataFromOtherPage = PropertyGetHandler.FetchDataFrom(name, properties);
if (dataFromOtherPage != null && dataFromOtherPage.Value != null)
{
return dataFromOtherPage;
}
if (FallbackProperties.ContainsKey(name))
{
var dataFallback = FallbackPropertyHandler(FallbackProperties[name].ToString(), properties);
if (dataFallback != null && dataFallback.Value != null)
{
return dataFallback;
}
}
return DynamicPropertyCache.DynamicPropertyFinder.FindDynamicProperty(name, properties) ?? data;
}
}
Is there a way that my "Heading" property can be set to the value of the "PageName" when I start editing a previously published page without having to save the page with this new value?