include/TemplateHandler/TemplateHandler.php
\TemplateHandler
TemplateHandler builds templates using SugarFields and a generic view.
Currently it handles EditViews and DetailViews. It creates a smarty template cached in cache/modules/moduleName/view
- Api
Properties
Methods
buildTemplate(
\module $module, \view $view, \tpl $tpl, \ajaxSave $ajaxSave, \metaDataDefs $metaDataDefs
)
:
void
Builds a template This is a private function that should be called only from checkTemplate method
Name | Type | Description |
---|---|---|
$module | \module | string module name |
$view | \view | string view need (eg DetailView, EditView, etc) |
$tpl | \tpl | string generic tpl to use |
$ajaxSave | \ajaxSave | boolean parameter indicating whether or not this is coming from an Ajax call |
$metaDataDefs | \metaDataDefs | metadata definition as Array |
checkTemplate(
\module $module, \view $view, $checkFormName
=
false, $formName
=
''
)
:
void
Checks if a template exists
Name | Type | Description |
---|---|---|
$module | \module | string module name |
$view | \view | string view need (eg DetailView, EditView, etc) |
$checkFormName | ||
$formName |
clearCache(
String $module, String $view
=
''
)
:
void
clearCache Helper function to remove cached .tpl files for a particular module
Name | Type | Description |
---|---|---|
$module | String | The module directory to clear |
$view | String | Optional view value (DetailView, EditView, etc.) |
createDependencyJavascript(
array $fieldDefs, array $viewDefs, string $view, $module
=
null
)
:
void
createDependencyJavascript Builds the javascript required to execute calculated/dependent fields and module-view dependences.
Name | Type | Description |
---|---|---|
$fieldDefs | array | The fields defs for the current module. |
$viewDefs | array | the viewdefs for the current view. |
$view | string | the current view type. |
$module |
createQuickSearchCode(
$defs, array $defs2, string $view
=
'', \strign $module
=
''
)
:
string
createQuickSearchCode This function creates the $sqs_objects array that will be used by the quicksearch Javascript code. The $sqs_objects array is wrapped in a $json->encode call.
Name | Type | Description |
---|---|---|
$defs | ||
$defs2 | array | The Meta-Data file definitions |
$view | string | |
$module | \strign |
Type | Description |
---|---|
string |
deleteTemplate(
\module $module, \view $view
)
:
void
Deletes an existing template
Name | Type | Description |
---|---|---|
$module | \module | string module name |
$view | \view | string view need (eg DetailView, EditView, etc) |
displayTemplate(
\module $module, \view $view, \tpl $tpl, \ajaxSave $ajaxSave
=
false, \metaData $metaDataDefs
=
null
)
:
void
Retreives and displays a template
Name | Type | Description |
---|---|---|
$module | \module | string module name |
$view | \view | string view need (eg DetailView, EditView, etc) |
$tpl | \tpl | string generic tpl to use |
$ajaxSave | \ajaxSave | boolean parameter indicating whether or not this is from an Ajax operation |
$metaDataDefs | \metaData | Optional metadata definition Array |
getQSDLookup(
)
:
array
Get lookup array for QuickSearchDefaults custom class
Type | Description |
---|---|
array |