Skip to content
This repository was archived by the owner on Jan 16, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Web.UI;
using Sitecore.Web.UI.WebControls;

namespace PixelMEDIA.SitecoreCMS.Controls.Controls
{
/// <summary>
/// Control to render mult-line text with option to stop Sitecore from replacing line feeds with
/// break tags. Needed when outputting javascript.
/// </summary>
public class MultilineTextRenderer : FieldRenderer
{
private bool _addScriptTags = false;
private bool _disableBreakTags = false;

public bool AddScriptTags
{
get { return _addScriptTags; }
set { _addScriptTags = value; }
}

public bool DisableBreakTags
{
get { return _disableBreakTags; }
set { _disableBreakTags = value; }
}

protected override void Render(System.Web.UI.HtmlTextWriter output)
{
if (Item == null)
{
Item = this.GetItem();
}
if (this.Item != null)
{
var dataField = this.Item.Fields[this.FieldName];
if (null == dataField) { return; }
var content = dataField.Value;
if (!String.IsNullOrEmpty(content))
{
if (AddScriptTags)
{
output.RenderBeginTag(HtmlTextWriterTag.Script);
}
if (DisableBreakTags)
{
output.Write(dataField.Value);
}
else
{
base.DoRender(output);
}
if (AddScriptTags)
{
output.RenderEndTag();
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Controls\CanonicalURL.cs" />
<Compile Include="Controls\HtmlFiveInput.cs" />
<Compile Include="Controls\Image.cs" />
<Compile Include="Controls\Panel.cs" />
<Compile Include="Controls\MultilineTextRenderer.cs" />
<Compile Include="EventHandlers\ItemEventHandler.cs" />
<Compile Include="Extensions\DataExtensions.cs" />
<Compile Include="Extensions\EnumerationExtensions.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.4")]
[assembly: AssemblyFileVersion("1.0.1.4")]
[assembly: AssemblyVersion("1.0.1.6")]
[assembly: AssemblyFileVersion("1.0.1.6")]