You are here

function pardot_admin_campaign in Pardot Integration 7

Same name and namespace in other branches
  1. 6 pardot.admin-campaign.inc \pardot_admin_campaign()
  2. 7.2 pardot.admin-campaign.inc \pardot_admin_campaign()

Form constructor for managing and viewing campaign entries.

See also

pardot_admin_campaign_validate()

pardot_admin_campaign_submit()

1 string reference to 'pardot_admin_campaign'
pardot_menu in ./pardot.module
Implements hook_menu().

File

./pardot.admin-campaign.inc, line 15
Admin campaign form.

Code

function pardot_admin_campaign($form, &$form_state) {
  $form = array();
  $campaigns = db_query('SELECT * FROM {pardot_campaign}');
  foreach ($campaigns as $campaign) {

    //dsm($campaign);
    $form['campaigns'][$campaign->campaign_id] = array(
      '#campaign' => $campaign,
      'campaign_id' => array(
        '#markup' => $campaign->campaign_id,
        '#value' => $campaign->campaign_id,
      ),
      'name' => array(
        '#markup' => $campaign->name,
        '#value' => $campaign->name,
      ),
      'paths' => array(
        '#markup' => $campaign->paths,
        // TODO: this needs some kind of replacement function to recognize <front>
        '#value' => $campaign->paths,
      ),
    );
  }
  $form['new'] = array(
    'campaign_id' => array(
      '#prefix' => '<div class="add-new-placeholder">' . t('Campaign ID') . '</div>',
      '#type' => 'textfield',
      '#size' => 10,
      //'#theme_wrapper' => 'theme_pardot_admin_campaign_textfield',
      '#suffix' => '<div class="description">' . t('Numeric campaign code(piCId) from tracking code preview in Pardot administration interface.') . '</div>',
    ),
    'name' => array(
      '#prefix' => '<div class="add-new-placeholder">' . t('Campaign name') . '</div>',
      '#type' => 'textfield',
      '#size' => 25,
      '#suffix' => '<div class="description">' . t('A short descriptive name for administration purposes. Can be the same as the campaign name in Pardot but not required.') . '</div>',
    ),
    'paths' => array(
      '#prefix' => '<div class="add-new-placeholder">' . t('Add new path') . '</div>',
      '#type' => 'textarea',
      '#wysiwyg' => FALSE,
      '#suffix' => '<div class="description">' . t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are blog for the blog page and blog/* for every personal blog. %front is the front page.", array(
        '%front' => '<front>',
      )) . '</div>',
    ),
  );
  $form['add'] = array(
    '#prefix' => '<div class="add-new-placeholder">&nbsp;</div>',
    '#type' => 'submit',
    '#value' => t('Add'),
  );
  return $form;
}