Why Glassmapper's Editable field doesnt invoke Sitecore RenderField pipeline

272 views Asked by At

In Sitecore MVC, we are using the following construct to display the field data in our views:

@Glass.Mapper.Sc.Mvc.GlassView.Editable(s => s.Field)

Unfortunately this doesn't seem to invoke the RenderFieldPipeline, unless I use

@[email protected]("field", item)

Is there a way to invoke the RenderFieldPipeline with the glassmapper's Editable construct? Just curious why would GM behave this way.

Thanks

1

There are 1 answers

0
maz On

For performance considerations, the renderField pipeline is not invoked by design (except in edit mode). See this discussion on GitHub.

As mentioned in the GitHub issue, if you only need this for single-line text fields, you can activate a setting in your annotation:

[SitecoreField(Setting = SitecoreFieldSettings.ForceRenderField)]
public virtual string MyField { get; set; }

You could also:

The exact approach will depend on your level of comfort and the exact reason you need to use the pipeline.