如何在自定义Orchard Workflow活动中添加以Form形式提交的内容选择器

时间:2016-08-20 23:14:30

标签: orchardcms

我创建了一个自定义的Orchard Workflow活动,此活动允许用户从管理UI中已创建的内容中选择内容项。现在允许选择内容项目我想在活动表格中使用内容选择器字段。但是我注意到Activity表单只使用基本形状,我找不到任何方法来创建可以使用已经创建的自定义字段的表单,或者允许使用自定义编辑器形状构建表单。

我已经能够使用选择列表(如下所示)实现某些功能,但我需要一种方法来添加内容选择器字段以形成或更好的方式来过滤表单中的内容项。

 context.Form("SendContentAsAttachement", factory =>
        {
            var shape = (dynamic)factory;
            var f = shape.Form(
            Id: "SendContentAsAttachement",
            _ContentList: shape.SelectList(
                Id: "contentId", Name: "contentId",
                Title: T("Response to user message"),
                Description: T("Please select a content to send to user")));

            var list = _contentManager.Query().ForType(new[] { "Type1", "type2", "type3", "type4"}).List().Select(item => new SelectListItem
            {
                Value = item.Id.ToString(),
                Text = string.Format("[{0}]{1}", item.TypeDefinition.DisplayName, item.As<TitlePart>().Title)
            });

            foreach (var item in list)
                f._ContentList.Add(item);

            return f;
        });

0 个答案:

没有答案
相关问题