Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Dev: added class variable cache for getTypeIcon
  • Loading branch information
LouisGac committed Aug 14, 2017
1 parent 69c31b7 commit c26a41c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions application/models/TemplateConfiguration.php
Expand Up @@ -47,12 +47,17 @@ class TemplateConfiguration extends TemplateConfig
*/
public $oParentTemplate;


// Caches

/** @var string $sPreviewImgTag the template preview image tag for the template list*/
public $sPreviewImgTag;

/** @var boolean $bTemplateCheckResult is the template valid?*/
public $bTemplateCheckResult;
private $bTemplateCheckResult;

/** @var string $sTypeIcon the type of template for icon (core vs user)*/
private $sTypeIcon;

/**
* @return string the associated database table name
Expand Down Expand Up @@ -285,12 +290,14 @@ public function addFileReplacement($sFile, $sType)

public function getTypeIcon()
{
if(Template::isStandardTemplate($this->template->name)){
$sIcon = gT("Core Template");
}else{
$sIcon = gT("User Template");
if (empty($this->sTypeIcon)){
if(Template::isStandardTemplate($this->template->name)){
$this->sTypeIcon = gT("Core Template");
}else{
$this->sTypeIcon = gT("User Template");
}
}
return $sIcon;
return $this->sTypeIcon;
}


Expand Down

0 comments on commit c26a41c

Please sign in to comment.