MCPcopy Create free account
hub / github.com/kataras/iris / renderView

Method renderView

context/context.go:3962–3983  ·  view source on GitHub ↗
(filename string, optionalViewModel ...interface{})

Source from the content-addressed store, hash-verified

3960}
3961
3962func (ctx *Context) renderView(filename string, optionalViewModel ...interface{}) error {
3963 cfg := ctx.app.ConfigurationReadOnly()
3964 layout := ctx.values.GetString(cfg.GetViewLayoutContextKey())
3965
3966 var bindingData interface{}
3967 if len(optionalViewModel) > 0 /* Don't do it: can break a lot of servers: && optionalViewModel[0] != nil */ {
3968 // a nil can override the existing data or model sent by `ViewData`.
3969 bindingData = optionalViewModel[0]
3970 } else {
3971 bindingData = ctx.values.Get(cfg.GetViewDataContextKey())
3972 }
3973
3974 if key := cfg.GetViewEngineContextKey(); key != "" {
3975 if engineV := ctx.values.Get(key); engineV != nil {
3976 if engine, ok := engineV.(ViewEngine); ok {
3977 return engine.ExecuteWriter(ctx, filename, layout, bindingData)
3978 }
3979 }
3980 }
3981
3982 return ctx.app.View(ctx, filename, layout, bindingData)
3983}
3984
3985const (
3986 // ContentBinaryHeaderValue header value for binary data.

Callers 1

ViewMethod · 0.95

Calls 8

ConfigurationReadOnlyMethod · 0.65
GetMethod · 0.65
GetViewDataContextKeyMethod · 0.65
ExecuteWriterMethod · 0.65
ViewMethod · 0.65
GetStringMethod · 0.45

Tested by

no test coverage detected