Esempio n. 1
0
        /// <inheritdoc />
        public IHtmlString GetFieldHtml(IReadonlyFieldConfiguration fieldConfiguration)
        {
            fieldConfiguration = fieldConfiguration ?? new ReadonlyFieldConfiguration(new FieldConfiguration());
            if (fieldConfiguration.FieldHtml != null)
            {
                return(fieldConfiguration.FieldHtml);
            }

            return(FieldGeneratorHandlersRouter <TModel, T> .GetHandler(this).GenerateFieldHtml(fieldConfiguration));
        }
Esempio n. 2
0
        /// <inheritdoc />
        public IReadonlyFieldConfiguration PrepareFieldConfiguration(IFieldConfiguration fieldConfiguration, FieldParent fieldParent)
        {
            fieldConfiguration = fieldConfiguration ?? new FieldConfiguration();
            if (!string.IsNullOrEmpty(Metadata.EditFormatString) && string.IsNullOrEmpty(fieldConfiguration.FormatString))
            {
                fieldConfiguration.WithFormatString(Metadata.EditFormatString);
            }
            if (!string.IsNullOrEmpty(Metadata.NullDisplayText) && string.IsNullOrEmpty(fieldConfiguration.NoneString))
            {
                fieldConfiguration.WithNoneAs(Metadata.NullDisplayText);
            }
            if (Metadata.IsReadOnly)
            {
                fieldConfiguration.Readonly();
            }

            var handler = FieldGeneratorHandlersRouter <TModel, T> .GetHandler(this);

            handler.PrepareFieldConfiguration(fieldConfiguration);
            Template.PrepareFieldConfiguration(this, handler, fieldConfiguration, fieldParent);

            return(new ReadonlyFieldConfiguration(fieldConfiguration));
        }