public IEnumerable <ElementAction> GetActions(EntityToken entityToken) { var providers = _providerContainer.GetProvidersFor(entityToken); var actions = providers.SelectMany(p => p.Provide(entityToken)); return(actions.ToList()); }
public IEnumerable <Element> Provide(ElementProviderContext context, EntityToken token) { var folder = (FormFolderEntityToken)token; if (folder.FolderType != "Fields") { yield break; } var form = ModelsFacade.GetModel(folder.FormName); if (form == null) { yield break; } if (_entityTokenHandlers == null) { _entityTokenHandlers = new ProviderContainer <IElementProviderFor>("FormBuilder"); } foreach (var field in form.Fields) { var elementHandle = context.CreateElementHandle(new FormFieldEntityToken(form.Name, field.Name)); var fieldElement = new Element(elementHandle) { VisualData = new ElementVisualizedData { Label = field.Name, ToolTip = field.Name, HasChildren = _entityTokenHandlers.GetProvidersFor(elementHandle.EntityToken).Any(), Icon = ResourceHandle.BuildIconFromDefaultProvider("localization-element-closed-root"), OpenedIcon = ResourceHandle.BuildIconFromDefaultProvider("localization-element-opened-root") } }; yield return(fieldElement); } }