You're quite right about why it's not working - MVC renderings don't execute the global conditional rendering rules.
This is not something I've had to do, but here's a suggestion. Someone might be able to suggest a better method, but this is a starter for 10.
You could look at amending the mvc.renderPlaceholder
pipeline to achieve what you want. The processor Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering
is what retrieves the renderings for a placeholder and calls the mvc.renderRendering
for each. It doesn't pass any placeholder information into this pipeline, so you would need to act here.
This is the method:
protected virtual void Render(string placeholderName, TextWriter writer, RenderPlaceholderArgs args)
{
foreach (Rendering rendering in this.GetRenderings(placeholderName, args))
PipelineService.Get().RunPipeline<RenderRenderingArgs>("mvc.renderRendering", new RenderRenderingArgs(rendering, writer));
}
You could extend this processor and override this method with one that executes rules for the rendering. It could then update the rendering
item that gets passed into the pipeline.
It's worth considering that Sitecore perhaps didn't implement the rules here due to performance issues, so rather than reintroduce global conditional rendering rules across all MVC renderings, you might want to make this a tailored processor that only acts differntly for particular renderings. This amended processor could potentially just inject the placeholder name into the rendering parameters, and then the rendering itself could decide how to act upon this.