Node Pre Values Node Factory
Node Pre Values Node Factory
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Umbraco.Forms.Data;
using umbraco.presentation.nodeFactory;
using umbraco.cms.businesslogic.web;
using Umbraco.Forms.Core;
namespace ContourExtensions {
public class NodePrevaluesNodeFactory : FieldPreValueSourceType {
public NodePrevaluesNodeFactory()
{
this.Id = new Guid("4F711F20-D5A6-4A2E-B678-4FBFFB3CDB2F");
this.Name = "Umbraco Documents (published)";
this.Description = "Uses published nodes from a specific source as
prevalues";
}
if (DocType != string.Empty)
{
int dtid = 0;
if (root != null)
{
foreach (Node n in root.Children)
{
if (n.NodeTypeAlias == DocType || DocType == string.Empty)
{
PreValue pv = new PreValue();
pv.Id = n.Id;
pv.Value = n.Name;
retval.Add(pv);
}
}
}
return retval;
}