You are here

function node_registration_form_views_form_alter in Node registration 7

Implements hook_form_FORM_ID_alter() for views_form().

File

./node_registration.module, line 1323

Code

function node_registration_form_views_form_alter(&$form, &$form_state) {

  // VBO settings form.
  if (isset($form_state['operation'])) {
    $op = $form_state['operation'];

    // Send mail action.
    if ($op->operationId == 'action::system_send_email_action' && $op->entityType == 'node_registration') {

      // Pre-fill the NR mail token.
      if (isset($form['recipient']['#type']) && empty($form['recipient']['#default_value'])) {
        $form['recipient']['#default_value'] = '[node-registration:mail]';
      }

      // Pre-fill mail text.
      if (isset($form['message']['#type']) && empty($form['message']['#default_value'])) {
        $form['message']['#default_value'] = "Hello [node-registration:user:name],\n" . "\n" . "Your registration ID is [node-registration:registration-id].";
      }

      // Add NR tokens.
      if (module_exists('token')) {
        $form['token_help'] = array(
          '#theme' => 'token_tree',
          '#dialog' => TRUE,
          '#token_types' => array(
            'node-registration',
          ),
          '#global_types' => variable_get('node_registration_token_tree_globals', FALSE),
        );
      }
    }
  }
}