Skip to content

Instantly share code, notes, and snippets.

@nul800sebastiaan
Created July 4, 2011 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nul800sebastiaan/1063205 to your computer and use it in GitHub Desktop.
Save nul800sebastiaan/1063205 to your computer and use it in GitHub Desktop.
Remove preview button in Umbraco
using System;
using umbraco.BusinessLogic;
using umbraco.presentation.masterpages;
namespace SomeCompanyName.EventHandlers
{
public class RemovePreviewButton : ApplicationBase
{
public RemovePreviewButton()
{
umbracoPage.Load += umbracoPage_Load;
}
void umbracoPage_Load(object sender, EventArgs e)
{
var umbracoPage = (umbracoPage)sender;
var path = umbracoPage.Page.Request.Path.ToLower().Replace((umbraco.GlobalSettings.Path + "/").ToLower(), "");
if (path != "editcontent.aspx") return;
var script = @"<script type=""text/javascript"">
$(document).ready(function () {
$('img[title=Preview]').remove()
});
</script>";
umbracoPage.Page.ClientScript.RegisterClientScriptBlock(umbracoPage.GetType(), "RemovePreviewButton", script, false);
}
}
}
@umair-syed-webjet
Copy link

Can i change the link on the preview button to preview the parent node instead of the current node?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment