6

We need some specific customization to hide a specific field for a specific language. like hiding Title field for English language but not for Spanish etc. Please suggest a any way to do this.

6

You need to override CanShowField method of Sitecore.Shell.Applications.ContentEditor.Pipelines.GetContentEditorFields.GetFields class so that it returns false for specific fields when Content Language is English.

Here is you can create class something like follows. You can add additional criteria like checking for particular template.

public class GetFields : Sitecore.Shell.Applications.ContentEditor.Pipelines.GetContentEditorFields.GetFields
{
    protected override bool CanShowField(Sitecore.Data.Fields.Field field, TemplateField templateField)
    {
        if (field.Name == "Title" && field.Language == Sitecore.Globalization.Language.Parse("es-Es"))
        {
            return false;
        }

        return base.CanShowField(field, templateField);
    }   
}

After that you should apply patch to include your custom class.

<getContentEditorFields>
    <processor type="Sitecore.Shell.Applications.ContentEditor.Pipelines.GetContentEditorFields.GetFields, Sitecore.Client">
        <patch:attribute name="type">YourClass, YourAssembly</patch:attribute>
    </processor>
</getContentEditorFields>

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.