You are here

function google_adwords_path_code_form in Google AdWords Conversion Tracking 7.2

Same name and namespace in other branches
  1. 8 modules/google_adwords_path/google_adwords_path.admin.inc \google_adwords_path_code_form()

Conversion code add / edit form.

1 string reference to 'google_adwords_path_code_form'
google_adwords_path_menu in modules/google_adwords_path/google_adwords_path.module
Implements hook_menu().

File

modules/google_adwords_path/google_adwords_path.admin.inc, line 51
Admin page for Google Adwords Path.

Code

function google_adwords_path_code_form($form, $form_state, $cid = NULL) {
  global $language;
  $form = array();

  // If updating existing code, add the conversion id to the form.
  if ($cid) {
    $code = google_adwords_path_load_code_by_cid($cid);
    $form['cid'] = array(
      '#type' => 'value',
      '#value' => $cid,
    );
  }
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Name'),
    '#default_value' => isset($code) ? $code['name'] : '',
    '#size' => 75,
    '#maxlength' => 64,
    '#required' => TRUE,
    '#description' => t('The name of this conversion code. This will appear in the administrative interface to easily identify it.'),
  );
  $form['conversion_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Conversion ID'),
    '#default_value' => isset($code) ? $code['conversion_id'] : '',
    '#size' => 15,
    '#maxlength' => 64,
    '#required' => TRUE,
  );
  $form['conversion_language'] = array(
    '#type' => 'textfield',
    '#title' => t('Conversion Language'),
    '#default_value' => isset($code) ? $code['conversion_language'] : variable_get('google_adwords_conversion_language', $language->language),
    '#size' => 15,
    '#maxlength' => 64,
    '#required' => TRUE,
  );
  $form['conversion_format'] = array(
    '#type' => 'textfield',
    '#title' => t('Conversion Format'),
    '#default_value' => isset($code) ? $code['conversion_format'] : variable_get('google_adwords_conversion_format', '2'),
    '#size' => 15,
    '#maxlength' => 64,
    '#required' => TRUE,
  );
  $form['conversion_color'] = array(
    '#type' => 'textfield',
    '#title' => t('Conversion Color'),
    '#default_value' => isset($code) ? $code['conversion_color'] : variable_get('google_adwords_conversion_color', 'FFFFFF'),
    '#size' => 15,
    '#maxlength' => 64,
    '#required' => TRUE,
  );
  $form['conversion_label'] = array(
    '#type' => 'textfield',
    '#title' => t('Conversion Label'),
    '#default_value' => isset($code) ? $code['conversion_label'] : '',
    '#size' => 30,
    '#maxlength' => 64,
    '#required' => TRUE,
  );
  $form['paths'] = array(
    '#type' => 'textarea',
    '#title' => t('Paths'),
    '#default_value' => isset($code) ? $code['paths'] : '',
    '#rows' => 8,
    '#cols' => 128,
    '#required' => TRUE,
    '#description' => t('A list of paths, separated by a new line, where this conversion code should be inserted.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  if ($cid) {
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
  }
  return $form;
}