Пример #1
0
        public virtual List <IBaseField> GetFieldDefinitions(Item i)
        {
            List <IBaseField> l = new List <IBaseField>();

            //check for fields folder
            Item Fields = i.GetChildByTemplate(FieldsFolderTemplateID);

            if (Fields.IsNull())
            {
                Logger.Log("there is no 'Fields' folder on the import item", i.Paths.FullPath, LogType.ImportDefinitionError);
                return(l);
            }

            //check for any children
            if (!Fields.HasChildren)
            {
                Logger.Log("there are no fields to import on  on the import item", i.Paths.FullPath, LogType.ImportDefinitionError);
                return(l);
            }

            ChildList c = Fields.Children;

            foreach (Item child in c)
            {
                var bf = FieldService.BuildBaseField(child);
                if (bf != null)
                {
                    l.Add(bf);
                }
                else
                {
                    Logger.Log("the field's class type could not be instantiated", child.Paths.FullPath, LogType.ImportDefinitionError, child.Name);
                }
            }

            return(l);
        }