Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 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);
     }
 }