I want to make choices for content items based on my tag values.
For example, I want to make an alternate call to do list-projectionpage-tag-specific
searching the net for me a new
ShapeDisplayEvents to apply
thus, I have
public class TagAlternatesFactory: ShapeDisplayEvents {public TagAlternatesFactory () {} public override void display (ShapeDisplayingContext context) {}} the method displays, I believe I have a contentItem off context.Shape Please check and make an alternate name based on that (assuming it has been added to the TagsPart content item).
However, after this what do I do with it? How do I add alternate names? And is it necessary to create a new alternative type? Orchard will look to see the list-projectionpage-tag-specific ?
I saw some orchard source took a cue commented Bertrand Direction
Here's my implementation:.
public class TagAlternatesFactory: ShapeDisplayEvents {public override void display (ShapeDisplayingContext context) {context.ShapeMetadata.OnDisplaying (displayedContext = & gt; {var contentItem = displayedContext.Shape.ContentItem; var contentType = contentItem .ContentType; ContentPart & gt ;; if (parts == null; var parts IEnumerable of & lt as = contentItem.Parts) return; Var tags (part = & gt; part of the tag part) as the tag; if (tag part == null) return; foreach (tag tag var.CurrentTags) {displayContext.ShapeMetadata.Alternates.Add (String.Format ( "{0} __ {1} __ {2} __ {3}", displays Contex. Showpate MetatataT See the update;};}} This is an optional view based on a tag value. So, if you have a project page that you want to apply to a specific style, you can create your own alternative view with just the name ProjectionPage_tag_special and at any time you launch Want to use the page, just add it to special this Tag.
Update I displayed the content box. Shapamatadata Type for the alternative name so that the specific size is overrun (like the list-launch page)
No comments:
Post a Comment