You are here

function ad_text_node_form in Advertisement 5

Same name and namespace in other branches
  1. 5.2 text/ad_text.module \ad_text_node_form()
  2. 6.3 text/ad_text.module \ad_text_node_form()
  3. 6 text/ad_text.module \ad_text_node_form()
  4. 6.2 text/ad_text.module \ad_text_node_form()

Adapi helper function for displaying a node form.

1 call to ad_text_node_form()
ad_text_adapi in text/ad_text.module

File

text/ad_text.module, line 158
Enhances the ad module to support static text ads.

Code

function ad_text_node_form(&$node) {
  $form = array();
  $form['ad_text'] = array(
    '#type' => 'fieldset',
    '#title' => t('Text'),
    '#collapsible' => TRUE,
  );
  $form['ad_text']['text'] = array(
    '#type' => 'markup',
    '#value' => ad_text_display_ad($node),
  );
  if (ad_adaccess($node->nid, 'manage ad text') || arg(1) == 'add' && user_access('create advertisements')) {
    $form['ad_text']['url'] = array(
      '#type' => 'textfield',
      '#title' => t('Destination URL'),
      '#required' => TRUE,
      '#maxlength' => 255,
      '#default_value' => $node->url,
      '#description' => t('Enter the complete URL where you want people to be redirected when they click on this advertisement.  The URL must begin with http:// or https://.  For example, %url.', array(
        '%url' => t('http://www.sample.org/'),
      )),
    );
    $form['ad_text']['adheader'] = array(
      '#type' => 'textfield',
      '#title' => t('Ad header'),
      '#required' => TRUE,
      '#default_value' => $node->adheader,
      '#description' => t('This is the first line of the ad which will be linked to the URL entered above.'),
    );
    $form['ad_text']['adbody'] = array(
      '#type' => 'textarea',
      '#title' => t('Ad body'),
      '#required' => TRUE,
      '#default_value' => $node->adbody,
      '#description' => t('This is the rest of the ad.'),
    );
  }
  return $form;
}