Whenever possible I try to extend Sitecore as cleanly as possible, such as trying to patch into pipelines and event handlers or overriding dialog without replacing the default ones. It’s not always possible and sometimes you just have to dive it and get things done. You’ll see the same thing in my blog posts, some are more “cleanly” implemented than others.
There have been a number of times when I need to supplement some existing code or to fix a bug in some Sitecore code. The usual way I have done this is to get dirty and edit the JS files directly. Not great, but it was quick 😀 It’s also the exact same thing that Sitecore Support does whenever we have to apply a JS fix.
I’ve generally found that it’s easier to extend C# code, since it’s where I am more familiar. But usually with the JS I have hacked and updated the default Sitecore files. Cos you know, when you simply need to add an extra 9 characters, you can’t be spending the whole day trying to figure out “a more clean way”. Ain’t nobody got time….
tl;dr; Install the module, set the config value to match your environment, have a stylised login screen and header bar per environment.
Have you ever sat there working on some task and then suddenly someone asks you to take a look at an issue on the Production environment? So you log onto that server, resolve the issue, get distracted for a few minutes by cat videos and then get back to what you were doing. But you suddenly realise that those changes you were just making was not on your local environment, you still had the Production site open in your browser tab! Oh noes!
The problem is that all the environments all looks exactly the same… the only difference being that teeny tiny URL bar, the URL in which probably also looks very similar apart from some environment prefix.
The RTE field in Sitecore is a little bit old fashioned and a little stricter than the most of us would like, especially when you are working with tech savvy editors who may prefer to work directly in the HTML. The current project I am working on is based on the Foundation framework and like most frameworks a lot of the features are enabled using data-* attributes.
Unfortunately the Telerik controls used in Sitecore try to be super helpful and strip out any invalid XHTML. Also unfortunately data-* attributes are HTML5, and not XHTML 😦
Storing SVGs in the Sitecore Media Library is pretty simple, just add a new
mediatype in config. This has been well documented and there are several posts as well as Stackoverflow/forum answers for this. e.g. https://community.sitecore.net/developers/f/8/t/1670
And this works fine and everything renders great, but whilst trying to sort out some servers issues and trawling through the Sitecore logs I noticed it was littered with Errors like so:
5920 15:34:49 ERROR Could not run the 'getMediaStream' pipeline for '/sitecore/media library/github-logo-01'. Original media data will be used.
Message: Parameter is not valid.
at System.Drawing.Bitmap..ctor(Stream stream)
at Sitecore.Resources.Media.ImageEffectsResize.ResizeImageStream(Stream inputStream, TransformationOptions options, ImageFormat outputFormat)
at Sitecore.Resources.Media.ImageThumbnailGenerator.GetStream(MediaData mediaData, TransformationOptions options)
at Sitecore.Resources.Media.MediaData.GetThumbnailStream(TransformationOptions options)
at Sitecore.Resources.Media.ThumbnailProcessor.Process(GetMediaStreamPipelineArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Resources.Media.Media.GetStreamFromPipeline(MediaOptions options, Boolean& canBeCached)
Following a question on Stackoverflow about filtering the css classes shown in the Rich Text Editor control, I thought I would share some simple code which is useful in various scenarios.
The RTE control used in Sitecore is Telerik RadEditor. The implementation is very flexible, and a lot of the configuration can be changed by changing the profile in the
core database under
/sitecore/system/Settings/Html Editor Profiles. You can easily switch the profile used on a per field basis by setting the source on the field definition:
On a recent question about storing custom field attributes for a field in Sitecore on Stackoverflow just over a week ago I suggested looking at the
Name Value List and
Name Lookup List field types. I have to admit that I have never used this field before, but knew of their existence and the general premise of the field.
If you are unaware of this field, it allows you to store Key/Value pairs of data. The underlying raw value of the field is then stored as url type parameters:
tl;dr A fix for Google Chrome 37+ which removed support for showModalDialog() and broke a lot of functionality in older releases of Sitecore and can be found on Github
11/09/2014: Sitecore have officially released patches for v6.4 to 7.0 for this bug. Glad to see that I was not a million miles off in my implementation though. Please use these patches instead: https://kb.sitecore.net/articles/581527
With the release of Google Chrome 37 we have finally lost our beloved modal dialogs created with showModalDialog(). This is used in all versions of Sitecore up to version 7.1. There is no official workaround for this yet, aside from use EnableDeprecatedWebPlatformFeatures Chrome policy, use a different browser or upgrade as stated in this knowledge base.
There was a fair amount of talk of this issue towards the end of last week, I also contributed on the main SDN thread and it seems we totally missed the issue being raised by Alex Pershteyn a few weeks ago. Well it appears those
showModalDialog() is deprecated messages in the console window actually meant something and apparently ignoring them didn’t make the problem go away 😦
tl;dr Custom Field which hides other fields in the Content Editor depending on the selected value
tl;dr Add custom resources in the Sitecore Content Editor from config setting