Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed issue: fruity variations not applied when extending fruity
  • Loading branch information
LouisGac committed Dec 22, 2017
1 parent 8c3c7d5 commit 2d3fce1
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions application/models/TemplateConfig.php
Expand Up @@ -263,7 +263,7 @@ protected function getDependsPackages($oTemplate)

// For list, so no "setConfiguration" before
public function getPreview()
{
{
if (empty($this->sPreviewImgTag)) {
if (is_a($this->template, 'Template')) {
$sTemplateFileFolder = Template::getTemplatesFileFolder($this->template->name);
Expand Down Expand Up @@ -327,7 +327,7 @@ public function getClassAndAttributes()

$aClassAndAttributes['class']['html'] = ' no-js ';

$aClassAndAttributes['class']['body'] = $this->sTemplateName;
$aClassAndAttributes['class']['body'] = $this->getTemplateAndMotherNames();

if (!empty($this->aCssFrameworkReplacement)) {
$aVariationFile = explode('/', $this->aCssFrameworkReplacement[0]); $aVariationFile = explode('.', end($aVariationFile));
Expand Down Expand Up @@ -894,6 +894,27 @@ public static function importManifest($sTemplateName, $aDatas)
}
}

/**
* Get a string containing the name of the current template and all its parents
* Used to inject those names into body classes
*/
public function getTemplateAndMotherNames()
{
$oRTemplate = $this;
$sTemplateNames = $this->sTemplateName;

while (!empty($oRTemplate->template->extends)) {

$sTemplateNames .= ' '.$oRTemplate->template->extends;
$oRTemplate = $oRTemplate->oMotherTemplate;
if (!($oRTemplate instanceof TemplateConfiguration)) {
// Throw alert: should not happen
break;
}
}
return $sTemplateNames;
}

/**
* Convert the values to a json.
* It checks that the correct values is inserted.
Expand Down

0 comments on commit 2d3fce1

Please sign in to comment.