U4-10560 - PublishedPropertyType has no reference to the content node id it belongs too

Created by Lennard Fonteijn 18 Oct 2017, 08:04:02 Updated by Sebastiaan Janssen 06 Sep 2018, 08:50:02

Tags: Gold partner

As the title says, this is problematic for a custom property my company has been making, as we need to lookup the data based on the content node id the property belongs to.

Unless we perform some very hacky dark magic by doing raw queries on Umbraco tables in the database (and even then, we have to make sure certain things are in place), the only alternative is making the PropertyValueConverter return an object with an Execute-method to enrich its logic, but that's also undesirable. Given the custom property performs as sort of two-way binding, it's also not sufficient to store the content node id inside cmsPropertyData so it gets injected through the source-property of ConvertDataToSource.

I would like to request the addition of the content node id to PublishedPropertyType, also see:

https://github.com/umbraco/Umbraco-CMS/blob/55098deac05b25e70acda5f847cc10a885922655/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs

From the looks of it, it's as simple as passing the id (or the full IPublishedContent _content for that matter) on this line:

https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Web/umbraco.presentation/page.cs#L484

Comments

Stephan 06 Sep 2018, 08:40:25

Hey - PublishedPropertyType ''cannot'' have a reference to any specific content node (or identifier) as there's only one instance of a PublishedPropertyType per... property type - not per node. What exactly are you trying to do? Could it be you are trying to reference the node (it's id, or other properties, or whatever) from within the PropertyValueConverter methods?

If so... the "fix" would be to pass that node to the PropertyValueConverter methods. In fact, that is implemented in v8's IPropertyValueConverter. On the other hand it would be hard to implement in v7 as that would be a breaking change.

Thoughts?


Sebastiaan Janssen 06 Sep 2018, 08:49:56

I'll close this for now, we can re-open if there's something non-breaking we could do. Feel free to leave more feedback or a usage example!


Priority: Normal

Type: Feature (request)

State: Closed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:

Sprint:

Story Points:

Cycle: