You are here

function hosting_web_server_form_alter in Hosting 5

File

web_server/hosting_web_server.module, line 401
Web server node type is defined here.

Code

function hosting_web_server_form_alter($form_id, &$form) {
  switch ($form_id) {
    case 'web_server_node_form':
      if ($form['#post']['op'] == 'Preview' && !$form['#post']['ip_address']) {
        $ip = gethostbyname($form['#post']['title']);

        // setup IP only if resolution succeeded
        if ($ip != $node->title) {
          drupal_set_message(t('Initialized the webserver IP to %ip based on hostname %name', array(
            '%ip' => $ip,
            '%name' => $form['#post']['title'],
          )), 'message');
          $form['#post']['ip_address'] = $ip;
        }
      }
      break;
  }
}