/// <inheritdoc /> public void Init(IBlock block, Purpose purpose, ILog parentLog) { //BlockBuilder = blockBuilder; Block = block; var view = Block.View; Log.LinkTo(parentLog); var root = TemplateHelpers.GetTemplatePathRoot(view.Location, Block.App); var subPath = view.Path; var templatePath = TryToFindPolymorphPath(root, view, subPath) ?? Http.Combine(root + "/", subPath); // Throw Exception if Template does not exist if (!File.Exists(Http.MapPath(templatePath))) { // todo: change to some kind of "rendering exception" throw new SexyContentException("The template file '" + templatePath + "' does not exist."); } Template = view; TemplatePath = templatePath; App = Block.App; DataSource = Block.Data; Purpose = purpose; // check common errors CheckExpectedTemplateErrors(); // check access permissions - before initializing or running data-code in the template CheckTemplatePermissions(Block.Context.Tenant); // Run engine-internal init stuff Init(); }