Dear EPIServer Team,
I used the PublishingContent event for blocks to check the selected elements before publish. If something is wrong, the publishing is cancelled.
It works, if the content editor creates blocks in "Assets pane", tab "Blocks".
The validation doesn't work for blocks, which are created in the ContenrArea (link "create a new block"), because the
e.Content.ContentLink is empty.
How to get the e.Content.ContentLink during the publishing for blocks, which are created using link "create a new block"?
Ah, ok I know what's problem.
Case 1: (Create block from asset tab)1. Create content (get content link)
2. Publish content (listen on Publishing event with existed contentLink)
Case 2: (Create from create link inside content area)
1. Create + Publish content in one phase (so publishing event has content link is empty) => Problem!
I think this is a bug, I'll report it.
But I wonder a little bit: In Case 2 editor should has Publish access level, so what do you want to do in this case (I guess that properties/values of content is not enough in your case) ?
But anyway its still a bug because Publishing event with empty content link is not make sense!
Eg., there is block, which has a link to a page. Content editor creates page, and forgets to publish it. Then he creates the block, set up the page as a link (but page is unpublished and it is not visible on site), publishes the block, and gets the error "Incorrect link".
Is there any build in attribute for property ContentReference to conrol that the content is published?
Thank you for help )