You are here

function hosting_server_services_from_post in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 server/hosting_server.module \hosting_server_services_from_post()
  2. 7.4 server/hosting_server.module \hosting_server_services_from_post()

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 server/hosting_server.module
Implements hook_presave().
hosting_server_validate in server/hosting_server.module
Implements hook_validate().

File

server/hosting_server.module, line 290

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]);
        }
      }
    }
  }
}