C# Class Sdl.Web.Tridion.Common.TemplateBase

Base class for common functionality used by TBBs
Inheritance: ITemplate
Datei anzeigen Open project: sdl/dxa-content-management

Public Methods

Method Description
GetComponent ( ) : Component

Returns the component object that is defined in the package for this template.

This method should only be called when there is an actual Component item in the package. It does not currently handle the situation where no such item is available.

GetPage ( ) : Page

Returns the Page object that is defined in the package for this template.

IsPageTemplate ( ) : bool

True if the rendering context is a page, rather than component

Transform ( Engine engine, Package package ) : void

Protected Methods

Method Description
AddBootstrapJsonBinary ( IList binaries, Component relatedComponent, StructureGroup sg, string variantName ) : void
AddJsonBinary ( object objectToSerialize, Component relatedComponent, StructureGroup structureGroup, string name, string variantId = null ) : Binary
ExtractKeyValuePairs ( Component component ) : string>.Dictionary
GetActiveModules ( ) : Component>.Dictionary
GetChildOrganizationalItem ( OrganizationalItem root, string title ) : OrganizationalItem
GetComponentTemplate ( ) : ComponentTemplate

Returns the Template from the resolved item if it's a Component Template

GetOrganizationalItemContents ( OrganizationalItem orgItem, ItemType itemType, bool recursive ) : string>>.List
GetPublication ( ) : Publication

Gets the context Publication.

GetRegionName ( ComponentTemplate template ) : string
GetSystemStructureGroup ( string subStructureGroupTitle = null ) : StructureGroup
GetUsingItems ( RepositoryLocalObject subject, ItemType itemType ) : string>>.List
Initialize ( Engine engine, Package package ) : void

Initializes the engine and package to use in this TemplateBase object.

IsMasterWebPublication ( Publication publication ) : bool
IsPreviewMode ( ) : bool
JsonSerialize ( object objectToSerialize ) : string
MergeData ( string>.Dictionary source, string>.Dictionary mergeData ) : string>.Dictionary
OutputSummary ( string name, IEnumerable files ) : void

Update the (JSON) summary in the Output item.

PutContextComponentOnTop ( ) : void

Put the context component back on top of the package stack As some TBBs (like SiteEdit ones) rely on this being the first Component in the stack

XmlElementToTcmUriList ( XmlElement data ) : string>>.List

Private Methods

Method Description
CheckInitialized ( ) : void
GetActiveModules ( Component coreConfigComponent ) : Component>.Dictionary
GetModuleConfigSchema ( ) : Schema
GetModuleNameFromItem ( RepositoryLocalObject item, string moduleRoot ) : string
IsPublishingToStaging ( ) : bool
JsonEncode ( object json ) : string
PublishBootstrapJson ( List filesCreated, Component relatedComponent, StructureGroup sg, string variantName = null, List additionalData = null ) : string
PublishJson ( string json, Component relatedComponent, StructureGroup sg, string filename, string variantName ) : string
PublishJsonData ( Dictionary settings, Component relatedComponent, string variantName, StructureGroup sg, bool isArray = false ) : List
PublishJsonData ( string>.Dictionary data, Component relatedComponent, string filename, string variantName, StructureGroup sg, bool isArray = false ) : string
PublishJsonData ( List settings, Component relatedComponent, string filename, string variantName, StructureGroup sg, bool isArray = false ) : string
StripModuleFromName ( string name ) : string

Method Details

AddBootstrapJsonBinary() protected method

protected AddBootstrapJsonBinary ( IList binaries, Component relatedComponent, StructureGroup sg, string variantName ) : void
binaries IList
relatedComponent Component
sg StructureGroup
variantName string
return void

AddJsonBinary() protected method

protected AddJsonBinary ( object objectToSerialize, Component relatedComponent, StructureGroup structureGroup, string name, string variantId = null ) : Binary
objectToSerialize object
relatedComponent Component
structureGroup StructureGroup
name string
variantId string
return Binary

ExtractKeyValuePairs() protected method

protected ExtractKeyValuePairs ( Component component ) : string>.Dictionary
component Component
return string>.Dictionary

GetActiveModules() protected method

protected GetActiveModules ( ) : Component>.Dictionary
return Component>.Dictionary

GetChildOrganizationalItem() protected method

protected GetChildOrganizationalItem ( OrganizationalItem root, string title ) : OrganizationalItem
root OrganizationalItem
title string
return OrganizationalItem

GetComponent() public method

Returns the component object that is defined in the package for this template.
This method should only be called when there is an actual Component item in the package. It does not currently handle the situation where no such item is available.
public GetComponent ( ) : Component
return Component

GetComponentTemplate() protected method

Returns the Template from the resolved item if it's a Component Template
protected GetComponentTemplate ( ) : ComponentTemplate
return ComponentTemplate

GetOrganizationalItemContents() protected method

protected GetOrganizationalItemContents ( OrganizationalItem orgItem, ItemType itemType, bool recursive ) : string>>.List
orgItem OrganizationalItem
itemType ItemType
recursive bool
return string>>.List

GetPage() public method

Returns the Page object that is defined in the package for this template.
public GetPage ( ) : Page
return Page

GetPublication() protected method

Gets the context Publication.
protected GetPublication ( ) : Publication
return Publication

GetRegionName() protected static method

protected static GetRegionName ( ComponentTemplate template ) : string
template ComponentTemplate
return string

GetSystemStructureGroup() protected method

protected GetSystemStructureGroup ( string subStructureGroupTitle = null ) : StructureGroup
subStructureGroupTitle string
return StructureGroup

GetUsingItems() protected method

protected GetUsingItems ( RepositoryLocalObject subject, ItemType itemType ) : string>>.List
subject RepositoryLocalObject
itemType ItemType
return string>>.List

Initialize() protected method

Initializes the engine and package to use in this TemplateBase object.
protected Initialize ( Engine engine, Package package ) : void
engine Engine The engine to use in calls to the other methods of this TemplateBase object
package Package The package to use in calls to the other methods of this TemplateBase object
return void

IsMasterWebPublication() protected method

protected IsMasterWebPublication ( Publication publication ) : bool
publication Publication
return bool

IsPageTemplate() public method

True if the rendering context is a page, rather than component
public IsPageTemplate ( ) : bool
return bool

IsPreviewMode() protected method

protected IsPreviewMode ( ) : bool
return bool

JsonSerialize() protected method

protected JsonSerialize ( object objectToSerialize ) : string
objectToSerialize object
return string

MergeData() protected method

protected MergeData ( string>.Dictionary source, string>.Dictionary mergeData ) : string>.Dictionary
source string>.Dictionary
mergeData string>.Dictionary
return string>.Dictionary

OutputSummary() protected method

Update the (JSON) summary in the Output item.
protected OutputSummary ( string name, IEnumerable files ) : void
name string The name of the Template.
files IEnumerable The files/binaries created by the Template.
return void

PutContextComponentOnTop() protected method

Put the context component back on top of the package stack As some TBBs (like SiteEdit ones) rely on this being the first Component in the stack
protected PutContextComponentOnTop ( ) : void
return void

Transform() public abstract method

public abstract Transform ( Engine engine, Package package ) : void
engine Engine
package Package
return void

XmlElementToTcmUriList() protected method

protected XmlElementToTcmUriList ( XmlElement data ) : string>>.List
data System.Xml.XmlElement
return string>>.List