Skip to content

Commit

Permalink
Dev: prepared code to implement for options upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jul 9, 2018
1 parent 6b364c6 commit 32e5de2
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions application/models/TemplateConfiguration.php
Expand Up @@ -641,6 +641,43 @@ public function setGlobalOption($name, $value)
}
}

// TODO
public function addOptionFromXMLToLiveTheme($name, $value)
{
if ($this->options != 'inherit') {

$oOptions = json_decode($this->options);
// $oXmlOptions = TemplateManifest::getOptions ?
// TODO: implement logic (it should read the XML file, compare the if all the option from the XML are present inside)
// Foreach ($oXmlOptions as $oXmlOption)
// if ($oXmlOption is not inside $oOptions)
// addOptionToLiveTheme($oXmlOption->name, $oXmlOptionvalue)
}
}

/**
* Add an option definition to the current theme.
* Will be used to turn ON ajax mode on update.
*
* @param string $name
* @param mixed $value
* @return void
*/
public function addOptionToLiveTheme($name, $value)
{
if ($this->options != 'inherit') {

$oOptions = json_decode($this->options);
$oOptions->$name = $value;
$sOptions = json_encode($oOptions);
$this->options = $sOptions;
$this->save();

}
}


/**
* Set option (unless if options is set to "inherit").
* @param string $name
Expand Down

0 comments on commit 32e5de2

Please sign in to comment.