You are here

function hosting_site_form_alter in Hosting 7.3

Same name and namespace in other branches
  1. 5 site/hosting_site.module \hosting_site_form_alter()
  2. 6.2 site/hosting_site.form.inc \hosting_site_form_alter()
  3. 7.4 site/hosting_site.form.inc \hosting_site_form_alter()

Implements hook_form_alter().

Hide the delete button on site nodes

File

site/hosting_site.form.inc, line 420
Site node form.

Code

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

  // Remove delete button from site edit form, unless the site's already been
  // deleted via the Delete task.
  if ($form_id == 'site_node_form') {
    $node = $form['#node'];
    if (isset($node->site_status) && $node->site_status !== HOSTING_SITE_DELETED) {
      $form['actions']['delete']['#type'] = 'hidden';
    }
  }
  if (array_key_exists('views_bulk_operations', $form)) {

    // Add our callback, so we can operate on the fully built form.
    $form['#after_build'][] = '_hosting_site_collapse_views_fieldset';
  }

  // On Delete task forms, if variable is set, set the --force option.
  if ($form_id == 'hosting_task_confirm_form' && $form['task']['#value'] == 'delete' && variable_get('hosting_delete_force', FALSE)) {
    $form['parameters']['force'] = array(
      '#type' => 'value',
      '#value' => 1,
    );
  }
}