You are here

function deploy_uuid_form_alter in Deploy - Content Staging 6

Implementation of hook_form_alter(),

Add the UUID into all node edit fields so that drupal_executes and form submissions handle this data properly. If you don't do this, then the uuid gets lost during a node save from drupal_execute(). Same goes for the user register form.

File

modules/deploy_uuid/deploy_uuid.module, line 235
Deployment UUID management

Code

function deploy_uuid_form_alter(&$form, $form_state, $form_id) {
  if (strpos($form_id, 'node_form') !== FALSE) {
    $node = $form['#node'];
    $form['uuid'] = array(
      '#type' => 'hidden',
      '#default_value' => isset($node->uuid) ? $node->uuid : '',
    );
  }
  if (strpos($form_id, 'user_register') !== FALSE) {
    $form['uuid'] = array(
      '#type' => 'hidden',
      '#default_value' => '',
    );
    $form['deploy'] = array(
      '#type' => 'hidden',
      '#default_value' => '',
    );
  }
}