9

We have just recently implemented a solution for this, to handle links to a specific template (Modal) differently. We created a custom renderField pipeline processor like the following: namespace Pipelines { public class RenderModalLink { public void Process(RenderFieldArgs args) { Assert.ArgumentNotNull(args, "args"); ...


4

Like Mark Cassidy said, no you can't do this with Glass. However you have another option in the Experience Editor (although not specific to Glass), if you want to give users the ability to still edit the field that is of type "File Upload". You can add a custom experience editor button to the rendering that displays the file upload. The first step is to ...


4

a) Adding proper references You can find "ContextService" in Sitecore.Mvc namespace / assembly. Just add below using to your razor view: using Sitecore.Mvc.Common; and in your project references add reference to "Sitecore.Mvc" assembly. You have couple of options to achieve this. Two of them are below: Using nuget feed Sitecore.Mvc.NoReferences ...


3

If you don't want to display time, but just a data simply change the Date format. Render if empty is to render field renderer in the Experience Editor even if the field doesn't have a value. Thanks to this, you will see "No text in field", and you will be able to fill it (in the Experience Editor). If you would like to display date all the time but ...


3

You could perhaps do this by injecting some custom JavaScript into content editor like so with a pipeline: Pipeline var page = HttpContext.Current.Handler as Page;   foreach (string script in _scripts) {     page.Header.Controls.Add(         new LiteralControl(             "<script type='text/javascript' language='javascript' src='{0}'></script&...


2

The reason why your code doesn't work for you: @Html.Sitecore().Field(Templates.PageText.Fields.PageTextHeading.ToString(), Model.Item, new { @class = headingStyle, EnclosingTag = headingRank }) is that Sitecore tries to add @class attribute to the tag rendered from the field value itself, not from the EnclosingTag. If your field was a LinkField, the ...


2

Yes, you can implement a custom field. You have several ways to do this. One of our project I used iframe field type for it. In my opinion this is the easiest way for complex custom fields. Actually I wrote a blogpost about the basics 2 days ago. Here is the whole solution which contains a similar custom field (for Sitecore 8.2 update 2, I gues it works for ...


2

No Not with Glass Mapper, not using vanilla tools and APIs. Looking at the official Sitecore Documentation for this (Edit content directly on the page) we learn that these are the fields are supported for inline editing (which is essentially what .Editable enables): Simple text fields – this field can only contain simple text, such as single-line and multi-...


2

1) One option would be to use Promo renderings + column and row splitters. I would split content first into 2 (or number of rows you need) rows with row splitter: and then I would put column splitter into each row splitter: Then you will add Promo component item each box that was created by splitters: You can assign images, links, texts to them as you ...


2

It seems that I was using the wrong Context Item when I use this RenderingContext.Current.Rendering.Item everything is working fine. Would be nice to know what is the difference between these two contexts


1

If you know the HTML already and also link field is specific no other changes then easy solution similar to Debu suggested - @Html.Sitecore().Field(GLink.Fields.Link.ToString(), Model.Item, new { text = <span> Model.Item.LinkFieldOptions(GLink.Fields.Link, LinkFieldOption.Text) </span> }) Here LinkFieldOptions is an extension ...


1

One very simple way would be: @Html.Sitecore().Field(linkfieldName, new { text = "something" })


1

Apologies for the Short answer. What you can try to implement is to use PageContext.Current.Item which will give you the Current page item or RenderingContext.Current.Rendering.Item Hope this helps!


1

The .Parameters property on the Rendering is just a key value pair and the value is the string containing the raw value for the field type. public string this[string parameterName] { get { return this.Values.ValueOrDefault<string, string>(parameterName); } set { Assert.IsNotNull((object) parameterName, nameof (parameterName)); ...


1

There is no out-of-the-box variant definition item to fetch content from an index. But you can create it yourself. One way would be to use NVelocity. A nice blog post on how to extend that can be found here: https://michaellwest.blogspot.com/2017/04/custom-rendering-variant-token-tool-for-sxa.html Create your processor, add it to the ...


1

You can use Maximal number of results field for this:


1

You should not use the Image items directly as datasources. To display images, the page list will look for an Image field and not for a Media field. One possible solution would be to create a template for datasource items that contain an Image field, a text field for your title, and possible other fields. Create items with this template and point the page ...


1

Your code looks correct, so long as the Sitecore.Context.Item is the item that you took a screenshot of in the experience editor. Otherwise, you should also set the Item preoperty of those <sc:Image> and <sc:FieldRenderer> controls. Publishing The first thing that you should look at is publishing, like @JayS mentioned in his comment. More ...


1

No, this is not doable with the existing General Link Field. Your options are: Have a Single Line Text field for first part, and generic link for the second part Use Rich Text Custom Field Type (this is definitely the most complicated options) I'd recommend first option if this only is needed in a few places. The third option is not trivial, so wouldn't ...


Only top voted, non community-wiki answers of a minimum length are eligible