コード例 #1
0
ファイル: Theme.php プロジェクト: ppiedaderawnet/concrete5
 public function setCustomStyleObject(\Concrete\Core\StyleCustomizer\Style\ValueList $valueList, $selectedPreset = false, CustomCssRecord $customCssRecord = null)
 {
     $db = Loader::db();
     $db->delete('PageThemeCustomStyles', ['pThemeID' => $this->getThemeID()]);
     $preset = false;
     if ($selectedPreset) {
         $preset = $selectedPreset->getPresetHandle();
     }
     $sccRecordID = 0;
     if ($customCssRecord !== null) {
         $sccRecordID = $customCssRecord->getRecordID();
     }
     $db->insert('PageThemeCustomStyles', ['pThemeID' => $this->getThemeID(), 'sccRecordID' => $sccRecordID, 'preset' => $preset, 'scvlID' => $valueList->getValueListID()]);
     // now we reset all cached css files in this theme
     $sheets = $this->getThemeCustomizableStyleSheets();
     foreach ($sheets as $s) {
         $s->clearOutputFile();
     }
     $scc = new \Concrete\Core\Page\CustomStyle();
     $scc->setThemeID($this->getThemeID());
     $scc->setValueListID($valueList->getValueListID());
     $scc->setPresetHandle($preset);
     $scc->setCustomCssRecordID($sccRecordID);
     return $scc;
 }
コード例 #2
0
ファイル: Page.php プロジェクト: robertdamoc/concrete5
 public function setCustomStyleObject(\Concrete\Core\Page\Theme\Theme $pt, \Concrete\Core\StyleCustomizer\Style\ValueList $valueList, $selectedPreset = false, $customCssRecord = false)
 {
     $db = Database::get();
     $db->delete('CollectionVersionThemeCustomStyles', array('cID' => $this->getCollectionID(), 'cvID' => $this->getVersionID()));
     $sccRecordID = 0;
     if ($customCssRecord instanceof CustomCssRecord) {
         $sccRecordID = $customCssRecord->getRecordID();
     }
     $preset = false;
     if ($selectedPreset) {
         $preset = $selectedPreset->getPresetHandle();
     }
     if ($customCssRecord instanceof CustomCssRecord) {
         $sccRecordID = $customCssRecord->getRecordID();
     }
     $db->insert('CollectionVersionThemeCustomStyles', array('cID' => $this->getCollectionID(), 'cvID' => $this->getVersionID(), 'pThemeID' => $pt->getThemeID(), 'sccRecordID' => $sccRecordID, 'preset' => $preset, 'scvlID' => $valueList->getValueListID()));
     $scc = new \Concrete\Core\Page\CustomStyle();
     $scc->setThemeID($pt->getThemeID());
     $scc->setValueListID($valueList->getValueListID());
     $scc->setPresetHandle($preset);
     $scc->setCustomCssRecordID($sccRecordID);
     return $scc;
 }