GetFieldSettingByName() public method

Returns the FieldSetting by passed field name.
public GetFieldSettingByName ( string fieldName ) : FieldSetting
fieldName string Inherited or owned Field name.
return FieldSetting
Beispiel #1
0
 private List<string> GetChoiceFieldOptions(ContentType contentType, string fieldName)
 {
     var cfs = contentType.GetFieldSettingByName(fieldName) as ChoiceFieldSetting;
     if (cfs != null)
     {
         return cfs.Options.Select(o => o.Text).ToList<string>();
     }
     return new List<string>();
 }
Beispiel #2
0
 public static PasswordCheckResult CheckPassword(ContentType contentType, string fieldName, string password, List<PasswordField.OldPasswordData> oldPasswords)
 {
     var pwFieldSetting = contentType.GetFieldSettingByName(fieldName) as PasswordFieldSetting;
     if (pwFieldSetting != null)
         throw new NotSupportedException(string.Format("Cannot check password if the field is not a PasswordField. ContentType: ", contentType, ", field: ", fieldName));
     return pwFieldSetting.CheckPassword(password, oldPasswords);
 }