Swiftriver\Core\Configuration\ConfigurationHandlers\DynamicModuleConfigurationHandler::Save PHP Method

Save() public method

Function that writes the configuration out to the same file it was written from
public Save ( )
    public function Save()
    {
        //Create the root xml element
        $root = new \SimpleXMLElement("<configuration></configuration>");
        //Add the modules collection element
        $modulesCollection = $root->addChild("modules");
        //Loop through the configurationstored in this class
        foreach ($this->Configuration as $key => $value) {
            //Gte the module name
            $module = $modulesCollection->addChild("module");
            //Add this name to the xml atribute
            $module->addAttribute("name", $key);
            //Add a collection element for the properties
            $properties = $module->addChild("properties");
            //Loop around the properties and add them to the collection element
            foreach ($value as $configurationElement) {
                $property = $properties->addChild("property");
                $property->addAttribute("name", $configurationElement->name);
                $property->addAttribute("type", $configurationElement->type);
                $property->addAttribute("description", $configurationElement->description);
                $property->addAttribute("value", $configurationElement->value);
            }
        }
        //Write out the xml to the file
        $root->asXML($this->configurationFilePath);
    }
DynamicModuleConfigurationHandler