public function hostingService::form

7.x-3.x hosting_server.service.inc public hostingService::form(&$form)

File

server/hosting_server.service.inc, line 99
Define the base Hosting service class.

Class

hostingService

Code

public function form(&$form) {
  if ($this->has_restart_cmd) {
    $form['restart_cmd'] = array(
      '#type' => 'textfield',
      '#title' => t('Restart command'),
      '#required' => !empty($this->available),
      '#description' => t('The command to run to restart this service.'),
      '#default_value' => (isset($this->restart_cmd)) ? $this->restart_cmd : $this->default_restart_cmd(),
      '#size' => 40,
      '#maxlength' => 255,
      '#weight' => -7,
    );
  }
  else {
    $form['restart_cmd'] = array(
      '#type' => 'value',
      '#value' => NULL,
    );
  }


  if ($this->has_port) {
    $form['port'] = array(
      '#type' => 'textfield',
      '#title' => t('Port'),
      '#required' => !empty($this->available),
      '#size' => 40,
      '#default_value' => isset($this->port) ? $this->port : $this->default_port(),
      '#description' => t("The port that this service is listening on."),
      '#maxlength' => 255,
      '#weight' => -8,
    );
  }
  else {
    $form['port'] = array(
      '#type' => 'value',
      '#value' => '0',
    );
  }

}