You are here

function hosting_server_init_services in Hosting 7.4

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

Initializes the service objects associated with a server node object.

@paramc $node The server node object.

Return value

Object The server node object with an additional 'services' property. The services property is an associative array with the name of the service as key, and the service object as value.

1 call to hosting_server_init_services()
hosting_server_load in server/hosting_server.module
Implements hook_load().

File

server/hosting_server.module, line 268

Code

function hosting_server_init_services(&$node) {
  $node->services = array();
  $result = db_query("SELECT service, type\n                      FROM {hosting_service}\n                      WHERE vid = :vid\n                      AND available = :available", array(
    ':vid' => $node->vid,
    ':available' => 1,
  ));
  foreach ($result as $record) {
    $name = $record->service;
    if ($service_object = hosting_services_new_object($name, $record->type, $node)) {
      $node->services[$name] = $service_object;
    }
  }
  return $node;
}