You are here

function ad_admin_group_form in Advertisement 5

Same name and namespace in other branches
  1. 5.2 ad.module \ad_admin_group_form()
  2. 6.3 ad.admin.inc \ad_admin_group_form()
  3. 6 ad.admin.inc \ad_admin_group_form()
  4. 6.2 ad.admin.inc \ad_admin_group_form()
  5. 7 ad.admin.inc \ad_admin_group_form()

Returns a form for adding an ad group.

1 string reference to 'ad_admin_group_form'
ad_menu in ./ad.module
Implementation of hook_menu().

File

./ad.module, line 2730
An advertising system for Drupal powered websites.

Code

function ad_admin_group_form($group = array()) {
  if ($_POST['op'] == t('Delete') || $_POST['edit']['confirm']) {
    drupal_goto('admin/content/ad/groups/' . $group['tid'] . '/delete');
  }
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Group name'),
    '#default_value' => $group['name'],
    '#maxlength' => 64,
    '#required' => TRUE,
    '#description' => t('Specify a name for the ad group.'),
  );
  $form['description'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#default_value' => $group['description'],
    '#required' => TRUE,
    '#description' => t('Describe this ad group.'),
  );
  $form['parent']['#tree'] = FALSE;
  $form['weight'] = array(
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#default_value' => $group['weight'],
    '#description' => t('When listing ad groups, those with lighter (smaller) weights get listed before ad groups with heavier (larger) weights.  Ad groups with equal weights are sorted alphabetically.'),
  );
  $form['vid'] = array(
    '#type' => 'hidden',
    '#value' => _ad_get_vid(),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  if ($group['tid']) {
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
    $form['tid'] = array(
      '#type' => 'value',
      '#value' => $group['tid'],
    );
  }
  return $form;
}