You are here

function hostingService_example_basic::load in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 example/hosting_example.service.inc \hostingService_example_basic::load()
  2. 7.4 example/example_service/hosting_example.service.inc \hostingService_example_basic::load()

Load associated values for the service.

In this example we will use the variable system to retrieve values.

Overrides hostingService::load

File

example/example_service/hosting_example.service.inc, line 72
Example service implementation for the hosting front end.

Class

hostingService_example_basic
An implementation of the example service type, registered with hook_hosting_service.

Code

function load() {

  // REMEMBER TO CALL THE PARENT!
  parent::load();
  $this->example_field = variable_get('hosting_example_field_' . $this->server->nid, 'default value');

  /**
   * Although this example does not have it's own tables, we provide some utitilty functions
   * for use in this method.
   *
   * If this example used it's own tables, we could use the mergeData method below to merge in the
   * results automatically, instead of iterating through the results ourself.
   */

  // $this->mergeData("SELECT example_field FROM {hosting_example} WHERE vid = :vid", array(':vid' => $this->server->vid));
}