You are here

function Provision_Service_example_basic::init_server in Hosting 7.4

Same name and namespace in other branches
  1. 7.3 example/example_service/drush/Provision/Service/example/basic.php \Provision_Service_example_basic::init_server()

Initialize this class, including option handling.

File

example/example_service/drush/Provision/Service/example/basic.php, line 54
A 'basic' implementation of the 'example' service type.

Class

Provision_Service_example_basic
A class containing the 'basic' implementation of the 'example' service.

Code

function init_server() {

  // REMEMBER TO CALL THE PARENT!
  parent::init_server();

  /**
   * Register configuration classes for the create_config / delete_config methods.
   */
  $this->configs['server'][] = 'Provision_Config_Example';

  /**
   * Setting and storing a value.
   *
   * You will most commonly use :
   *    $this->server->setProperty('example_field', 'default');
   *
   * This helper will check for an existing saved value, overridden
   * by a command line option falling back to the default.
   *
   * This is the format used by everything you want configurable from
   * the front end or command line.
   *
   * These values will be saved in ~/.drush/server_name.drush.alias.inc.
   */
  $this->server
    ->setProperty('example_field', 'default');

  /**
   * Non configurable values.
   *
   * If you want to generate values for use in your code or templates,
   * but don't want them to be overridden you would use the following format.
   *
   *   $this->server->example_config_path = $this->server->config_path . '/example.d'
   *
   * This will mean the value will change if you change the config path, but
   * you dont need to pass the right input to your command to get there,
   * and it's impossible to change the values.
   */
  $this->server->example_config_path = $this->server->config_path . '/example.d';
}