public function submit() { if ($this->validateAction()) { $record = new CustomCssRecord(); $record->setValue($this->request->request('value')); $record->save(); $ax = new \stdClass(); $ax->sccRecordID = $record->getRecordID(); return $this->app->make(ResponseFactoryInterface::class)->json($ax); } }
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; }
public function setCustomStyleObject(\Concrete\Core\Page\Theme\Theme $pt, \Concrete\Core\StyleCustomizer\Style\ValueList $valueList, $selectedPreset = false, CustomCssRecord $customCssRecord = null) { $db = Database::connection(); $db->delete('CollectionVersionThemeCustomStyles', ['cID' => $this->getCollectionID(), 'cvID' => $this->getVersionID()]); $preset = false; if ($selectedPreset) { $preset = $selectedPreset->getPresetHandle(); } $sccRecordID = 0; if ($customCssRecord !== null) { $sccRecordID = $customCssRecord->getRecordID(); } $db->insert('CollectionVersionThemeCustomStyles', ['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; }