/** * @test * @group library */ public function deleteByIdShouldDeleteOverwrittenLocalModuleEvenIfTemplateAssociatedToModule() { // ARRANGE $websiteId = $this->websiteIdWithLocalAndGlobalModules; $localAndGlobalModuleId = 'rz_tests_module_local_and_global'; // ACT $this->service->delete($localAndGlobalModuleId, $websiteId); $module = $this->service->getById($localAndGlobalModuleId, $websiteId); // ASSERT $this->assertInstanceOf('\\Cms\\Data\\Modul', $module); $this->assertEquals($localAndGlobalModuleId, $module->getId()); $this->assertFalse($module->isOverwritten()); }
/** * Aktualisiert die Default-Werte in den globalen Variablen * * @param string $websiteId * @param mixed $globalcontent * @param \Cms\Service\Modul */ public function insertDefaultValuesIntoGlobalContent($websiteId, &$globalContent, \Cms\Service\Modul $moduleService) { // ggf. Globale Variablen in Array umwandeln if (is_string($globalContent)) { $globalContent = \Zend_Json::decode($globalContent); } if (is_array($globalContent) && count($globalContent) > 0) { foreach ($globalContent as $varName => &$units) { foreach ($units as &$unitData) { // Modul-Id vorhanden? if (isset($unitData['moduleId'])) { // Muss noch die globalen Variablen-Namen dieses Moduls ermittelt werden? if (isset($unitData['moduleId']) && !empty($unitData['moduleId']) && !isset($this->moduleFormValues[$websiteId][$unitData['moduleId']])) { // Form-Werte des Moduls ermitteln try { $module = $moduleService->getById($unitData['moduleId'], $websiteId); $formValues = $module->getFormvalues(); if (is_string($formValues)) { $formValues = \Zend_Json::decode($formValues); } $this->moduleFormValues[$websiteId][$unitData['moduleId']] = $formValues; } catch (\Exception $e) { } } // Globale Felder vorhanden if (is_array($this->moduleFormValues[$websiteId][$unitData['moduleId']]) && count($this->moduleFormValues[$websiteId][$unitData['moduleId']]) > 0) { // Modul-Wert des globalen Feldes vorhanden? if (isset($unitData['isUnitValue']) && !$unitData['isUnitValue']) { if (isset($this->moduleFormValues[$websiteId][$unitData['moduleId']][$varName])) { $unitData['value'] = $this->moduleFormValues[$websiteId][$unitData['moduleId']][$varName]; } } } } } } } }