You are here

function hosting_platform_form_alter in Hosting 7.4

Same name and namespace in other branches
  1. 6.2 platform/hosting_platform.module \hosting_platform_form_alter()
  2. 7.3 platform/hosting_platform.module \hosting_platform_form_alter()

Hide the delete button on platform nodes.

File

platform/hosting_platform.module, line 520
Platform node type definition.

Code

function hosting_platform_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'platform_node_form':

      // Remove delete button from platform edit form,
      // unless the platform's already been deleted via the Delete task.
      $node = $form['#node'];
      if (isset($node->platform_status) && $node->platform_status !== HOSTING_PLATFORM_DELETED) {
        $form['actions']['delete']['#type'] = 'hidden';
      }
      break;
    case 'hosting_settings':
      $form['hosting_platform_base_path'] = array(
        '#type' => 'textfield',
        '#title' => t('Platform base path'),
        '#description' => t('The base path for your platforms, i.e. /var/aegir/platforms/'),
        '#default_value' => variable_get('hosting_platform_base_path', '/var/aegir/platforms/'),
      );
      break;
  }
}