You are here

function hosting_server_services_from_post in Hostmaster (Aegir) 6

Translate a server form submission into populated server objects on the node.

2 calls to hosting_server_services_from_post()
hosting_nodeapi_server_presave in modules/hosting/server/hosting_server.module
Implementation of hook_presave()
hosting_server_validate in modules/hosting/server/hosting_server.module
Implementation of hook_validate().

File

modules/hosting/server/hosting_server.module, line 168

Code

function hosting_server_services_from_post(&$node) {
  if (isset($node->services) && is_array($node->services)) {
    foreach (hosting_server_services() as $name => $data) {
      if (isset($node->services[$name]) && is_array($node->services[$name])) {
        if ($node->services[$name]['type'] !== 'null') {
          if ($service_object = hosting_services_new_object($name, $node->services[$name]['type'], $node, $node->services[$name][$node->services[$name]['type']])) {
            $node->services[$name] = hosting_services_new_object($name, $node->services[$name]['type'], $node, $node->services[$name][$node->services[$name]['type']]);
            $node->services[$name]->available = TRUE;
          }
        }
        else {
          unset($node->services[$name]);
        }
      }
    }
  }
}