public static string LinkFieldOptions(this Item item, ID fieldID, LinkFieldOption option) { XmlField field = item.Fields[fieldID]; switch (option) { case LinkFieldOption.Text: return(field?.GetAttribute("text")); case LinkFieldOption.LinkType: return(field?.GetAttribute("linktype")); case LinkFieldOption.Class: return(field?.GetAttribute("class")); case LinkFieldOption.Alt: return(field?.GetAttribute("title")); case LinkFieldOption.Target: return(field?.GetAttribute("target")); case LinkFieldOption.QueryString: return(field?.GetAttribute("querystring")); default: throw new ArgumentOutOfRangeException(nameof(option), option, null); } }
public static string LinkFieldOptions(this Item item, ID fieldID, LinkFieldOption option) { XmlField field = item.Fields[fieldID]; switch (option) { case LinkFieldOption.Text: return field?.GetAttribute("text"); case LinkFieldOption.LinkType: return field?.GetAttribute("linktype"); case LinkFieldOption.Class: return field?.GetAttribute("class"); case LinkFieldOption.Alt: return field?.GetAttribute("title"); case LinkFieldOption.Target: return field?.GetAttribute("target"); case LinkFieldOption.QueryString: return field?.GetAttribute("querystring"); default: throw new ArgumentOutOfRangeException(nameof(option), option, null); } }