protected override void OnDisplaying(Label element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedText = _tokenizer.Replace(element.Text, context.GetTokenData(), new ReplaceOptions {
         Encoding = ReplaceOptions.NoEncode
     });
     context.ElementShape.ProcessedFor = _tokenizer.Replace(element.For, context.GetTokenData());
 }
 protected override void OnDisplaying(PasswordField element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedName  = _tokenizer.Replace(element.Name, context.GetTokenData());
     context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData(), new ReplaceOptions {
         Encoding = ReplaceOptions.NoEncode
     });
 }
 protected override void OnDisplaying(TextArea element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedName  = _tokenizer.Replace(element.Name, context.GetTokenData());
     context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData(), new ReplaceOptions {
         Encoding = ReplaceOptions.NoEncode
     });
     context.ElementShape.ProcessedValue = element.RuntimeValue;
 }
Ejemplo n.º 4
0
        protected override void OnDisplaying(Form element, ElementDisplayContext context)
        {
            var controller = _currentControllerAccessor.CurrentController;
            var modelState = controller != null?controller.FetchModelState(element) : default(ModelStateDictionary);

            if (modelState != null && !modelState.IsValid)
            {
                // Read any posted values from the previous request.
                var values = controller.FetchPostedValues(element);
                _formService.ReadElementValues(element, new NameValueCollectionValueProvider(values, _cultureAccessor.CurrentCulture));

                // Add any model validation errors from the previous request.
                controller.ApplyAnyModelErrors(element, modelState);
            }

            // Assign the binding content type to each element within the form element.
            foreach (var child in element.Elements.Flatten().Where(x => x is FormElement).Cast <FormElement>())
            {
                child.FormBindingContentType = element.CreateContent == true ? element.FormBindingContentType : default(string);
            }

            // Set tokenized properties.
            var tokenData = context.GetTokenData();

            context.ElementShape.ProcessedAction = _tokenizer.Replace(element.Action, tokenData);
        }
        protected override void OnDisplaying(Enumeration element, ElementDisplayContext context)
        {
            var typeName    = element.GetType().Name;
            var displayType = context.DisplayType;
            var tokenData   = context.GetTokenData();

            context.ElementShape.ProcessedName    = _tokenizer.Replace(element.Name, tokenData);
            context.ElementShape.ProcessedLabel   = _tokenizer.Replace(element.Label, tokenData);
            context.ElementShape.ProcessedOptions = _tokenizer.Replace(element.Options, tokenData).ToArray();
            context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}", typeName, element.InputType));
            context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
        }
        protected override void OnDisplaying(ReCaptcha element, ElementDisplayContext context)
        {
            var workContext = _services.WorkContext;
            var currentSite = workContext.CurrentSite;
            var settings    = currentSite.As <ReCaptchaSettingsPart>();

            if (settings.TrustAuthenticatedUsers && workContext.CurrentUser != null)
            {
                return;
            }

            context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
            context.ElementShape.PublicKey     = settings.PublicKey;
        }
        protected override void OnDisplaying(Taxonomy element, ElementDisplayContext context)
        {
            var taxonomyId  = element.TaxonomyId;
            var typeName    = element.GetType().Name;
            var displayType = context.DisplayType;
            var tokenData   = context.GetTokenData();

            context.ElementShape.ProcessedName  = _tokenizer.Replace(element.Name, tokenData);
            context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, tokenData, new ReplaceOptions {
                Encoding = ReplaceOptions.NoEncode
            });
            context.ElementShape.TermOptions = GetTermOptions(element, context.DisplayType, taxonomyId, tokenData).ToArray();
            context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}__{1}", typeName, element.InputType));
            context.ElementShape.Metadata.Alternates.Add(String.Format("Elements_{0}_{1}__{2}", typeName, displayType, element.InputType));
        }
 protected override void OnDisplaying(Fieldset element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedLegend = _tokenizer.Replace(element.Legend, context.GetTokenData());
 }
 protected override void OnDisplaying(HiddenField element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedName  = _tokenizer.Replace(element.Name, context.GetTokenData());
     context.ElementShape.ProcessedValue = _tokenizer.Replace(element.Value, context.GetTokenData());
 }
Ejemplo n.º 10
0
 protected override void OnDisplaying(ValidationMessage element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedFor = _tokenizer.Replace(element.For, context.GetTokenData());
 }
 protected override void OnDisplaying(RadioButton element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedName  = _tokenizer.Replace(element.Name, context.GetTokenData());
     context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData());
     context.ElementShape.ProcessedValue = _tokenizer.Replace(element.Value, context.GetTokenData());
 }
Ejemplo n.º 12
0
 protected override void OnDisplaying(Paragraph element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "html", context.GetTokenData());
 }
 protected override void OnDisplaying(Fieldset element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedLegend = _tokenizer.Replace(element.Legend, context.GetTokenData(), new ReplaceOptions {
         Encoding = ReplaceOptions.NoEncode
     });
 }
Ejemplo n.º 14
0
 protected override void OnDisplaying(Text element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "textarea", context.GetTokenData());
 }
Ejemplo n.º 15
0
 protected override void OnDisplaying(Button element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, context.GetTokenData());
     context.ElementShape.ProcessedText = _tokenizer.Replace(element.Text, context.GetTokenData());
 }
Ejemplo n.º 16
0
 protected override void OnDisplaying(ImageFileField element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedName  = _tokenizer.Replace(element.Name, context.GetTokenData());
     context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, context.GetTokenData());
     context.ElementShape.ProcessedValue = _tokenizer.Replace(element.RuntimeValue, context.GetTokenData());
 }
Ejemplo n.º 17
0
 protected override void OnDisplaying(Heading element, ElementDisplayContext context)
 {
     context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "html", context.GetTokenData());
     context.ElementShape.Level            = element.Level;
 }