protected override DriverResult Editor(ReCaptchaPart part, dynamic shapeHelper) { var workContext = _workContextAccessor.GetContext(); // don't display the part in the admin if (AdminFilter.IsApplied(workContext.HttpContext.Request.RequestContext)) { return(null); } return(ContentShape("Parts_ReCaptcha_Fields", () => { var settings = workContext.CurrentSite.As <ReCaptchaSettingsPart>(); if (settings.TrustAuthenticatedUsers && workContext.CurrentUser != null) { return null; } var viewModel = new ReCaptchaPartEditViewModel { PublicKey = settings.PublicKey }; return shapeHelper.EditorTemplate(TemplateName: "Parts.ReCaptcha.Fields", Model: viewModel, Prefix: Prefix); })); }
protected override DriverResult Editor(ReCaptchaPart part, dynamic shapeHelper) { return(ContentShape("Parts_ReCaptcha_Fields", () => { var settings = part.TypePartDefinition.Settings.GetModel <ReCaptchaPartSettings>(); var viewModel = new ReCaptchaPartEditViewModel { PublicKey = settings.PublicKey }; return shapeHelper.EditorTemplate(TemplateName: "Parts.ReCaptcha.Fields", Model: viewModel, Prefix: Prefix); })); }