/// <summary> /// If the Rendering expects a Datasource and it is Null or Empty, return the Blank View. /// </summary> /// <param name="database"></param> /// <param name="rendering"></param> /// <param name="path"></param> /// <returns></returns> private string GetPath(Database database, Rendering rendering, string path) { if (!RenderingExtensions.RequiresDatasource(rendering.RenderingItem) || RenderingExtensions.DatasourceExists(database, rendering.DataSource)) { return(path); } Log.Warn($"EXPERIENCE EDITOR - Datasource needs set on the View Rendering: {rendering.RenderingItem.DisplayName}, Path: {rendering.Item.Paths.FullPath}, ID: {rendering.Item.ID}.", this); return(ExperienceEditorConstants.Views.BlankViewPath); }
protected IMarker GetMarker(Rendering rendering) { // If the Rendering's Datasource Template field is empty, we assume that it does not need a Datasource to function. if (!RenderingExtensions.RequiresDatasource(rendering.RenderingItem)) { return(null); } // If the rendering has a valid Datasource, do not add the Wrapper otherwise add it. return(Context.ContentDatabase.GetItem(rendering.DataSource) == null ? new DatasourceRenderingMarker(RenderingContext.Current, rendering.RenderingItem.DisplayName) : null); }
public override void Process(GetRendererArgs args) { var rendering = args.Rendering; var database = Sitecore.Context.Database; if (!database.Name.Equals("core") && RenderingExtensions.RequiresDatasource(rendering.RenderingItem) && !RenderingExtensions.DatasourceExists(database, rendering.DataSource) && !rendering.RenderingType.Equals("Layout")) { // Return Blank View if the Rendering Requires a Datasource and the Datasource doesn't exist. args.Result = this.GetRenderer(rendering, args); // Log for funzies Log.Warn($"EXPERIENCE EDITOR - Datasource needs set on the Controller Rendering: {rendering.RenderingItem.DisplayName}, Path: {rendering.Item.Paths.FullPath}, ID: {rendering.Item.ID}.", this); return; } base.Process(args); }