You are here

function hosting_form_alter in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 hosting.module \hosting_form_alter()
  2. 7.4 hosting.module \hosting_form_alter()

Implements hook_form_alter().

File

./hosting.module, line 1075
Hosting module.

Code

function hosting_form_alter(&$form, &$form_state, $form_id) {

  // Do not allow package or task nodes to be edited through the interface.
  if ($form_id == 'package_node_form' || $form_id == 'task_node_form') {
    drupal_access_denied();
    exit;
  }

  // Alter the 'Add User' form to remind users that this is not the New Client
  // form.
  if ($form_id == 'user_register') {
    $form['user_registration_help'] = array(
      '#type' => 'item',
      '#description' => t('<strong>Adding a system user account does not make the user a Client that can add sites.</strong><br />
                     To add a Client, enable the Client feature and then add a new Client node.<br />
                     If you wish, you may then assign this system user to the Client as an \'Allowed user\' to inherit the permissions to add sites.'),
      '#weight' => '-10',
    );
  }

  // Remove additional UI added by core modules, it conflicts with the our UI.
  $node_types = array(
    'site',
    'platform',
    'server',
    'client',
  );
  foreach ($node_types as $type) {
    if ($form_id == $type . '_node_form') {
      $form['options']['#access'] = FALSE;
      $form['revision_information']['#access'] = FALSE;
      $form['author']['#access'] = FALSE;

      // Because these aren't really posts, 'preview' doesn't make sense in
      // this context.
      $form['actions']['preview']['#access'] = FALSE;

      // Add our own helpful messages.
      $form['#submit'][] = 'hosting_form_submit_messages';
    }
  }
}