The extension context

Extensions receive an instance of the SMContext class from the controller, which executes all the extensions. The object is passed using the contructor defined on the SMExtension base class, from which all extension inherits. The table below describes the functionality, and information accessible, in greater details.


SMContext class

Function
Return type
Description
__construct($extensionName:string, $template:SMTemplate, $form:SMForm, $execMode:SMExecutionMode, $templateType:SMTemplateType)

Constructor used to create new instance of the context class. This is only used by the controller, when create instances of each extension.
GetExtensionName()
String
Returns the name of the extension (name of folder in which the extension is installed).
GetTemplate()
SMTemplate
Returns reference to the template being populated with information.
GetForm()
SMForm
Returns reference to the form component which is used to ie change enctype, allowing file upload to take place. In most cases the form component should not be changed.
GetExecutionMode()
SMExecutionMode
Returns execution mode (Shared or Dedicated).
GetTemplateType()
SMTemplateType
Returns the type of the template (SMTemplateType::$Normal or SMTemplateType::$Basic). Normal is returned when the index.html file is used as the template, Basic is returned when the basic.html file is used a the template (usually for pop-up windows).