コード例 #1
0
        private void PostProcessPlacedWidget(UpdateContentContext context, WidgetPart part) {
            if (!part.IsPlaceableContent())
                return;

            // This is a widget placed on a layout, so clear out the zone propertiey
            // to prevent the widget from appearing on the Widgets screen and on the front-end.
            part.Zone = null;

            // To prevent the widget from being recognized as being orphaned, set its container.
            // If the current container is a LayerPart, override that as well.
            var commonPart = part.As<ICommonPart>();
            if (commonPart != null && (commonPart.Container == null || commonPart.Container.Is<LayerPart>())) {
                commonPart.Container = _orchardServices.WorkContext.CurrentSite;
            }
        }
コード例 #2
0
 private static bool UseCache(WidgetPart widgetPart, ControllerContext controllerContext)
 {
     var cachePart = widgetPart.As<OutputCachePart>();
     return cachePart != null && cachePart.Enabled;
 }