1

In the experience editor, there is a default text displayed when one clears the text : [no text in field].

Is there a possibility to customize this text and eventually have one different for each fields ?

Example :

name field --> display :[name field empty]

Phone field --> display : [phone field empty]

3

The GetDefaultText method in Sitecore.Pipelines.RenderField.RenderWebEditing prefix the placeholder text with the Display Name of the field.

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <renderField>
        <processor patch:before="*[1]" type="MyProject.CMS.Custom.Pipelines.RenderField.ShowTitleWhenBlank, MyProject.CMS.Custom" />
      </renderField>
    </pipelines>
  </sitecore>
</configuration>


using Sitecore.Pipelines.RenderField;    
namespace MyProject.CMS.Custom.Pipelines.RenderField
{
    public class ShowTitleWhenBlank
    {
        public void Process(RenderFieldArgs args)
        {
            args.RenderParameters["show-title-when-blank"] = "true";
        }
    }
}

For more information you can refer to https://jammykam.wordpress.com/2017/09/20/show-title-when-blank/

  • Looks great ! i'll give it a try – Slrg Mar 6 '18 at 12:26
  • It seems to work only for all the fields except links (nothing displayed) Do you happen to know where that problem can come from ? – Slrg Mar 6 '18 at 14:00
0

Right now there is no way to customize this text in SXA. What is more, it's not an SXA responsibility. We are using Sitecore field renderers in Rendering Variants. This text is rendered by particular field renderer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.