コード例 #1
0
        public override void Displaying(ShapeDisplayingContext context)
        {
            context.ShapeMetadata.OnDisplaying(displayedContext => {
                if (!IsActivable())
                {
                    return;
                }

                if (context.ShapeMetadata.Type != "EditorTemplate" &&
                    context.ShapeMetadata.Type != "Zone")
                {
                    return;
                }

                ContentItem contentItem = context.Shape.ContentItem;

                // if not, check for ContentPart
                if (contentItem == null)
                {
                    ContentPart contentPart = context.Shape.ContentPart;
                    if (contentPart != null)
                    {
                        contentItem = contentPart.ContentItem;
                    }
                }

                var className = "content-" + _workContext.GetTextDirection(contentItem);

                if (!_workContext.Layout.Content.Classes.Contains(className))
                {
                    _workContext.Layout.Content.Classes.Add(className);
                }
            });
        }
コード例 #2
0
 public static string GetTextDirection(this WorkContext workContext)
 {
     return(workContext.GetTextDirection(null));
 }