You are here

function ad_admin_group_form in Advertisement 6.3

Same name and namespace in other branches
  1. 5.2 ad.module \ad_admin_group_form()
  2. 5 ad.module \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.admin.inc, line 734
Advertisement admin pages and functions.

Code

function ad_admin_group_form($form_state, $group = NULL) {
  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Group name'),
    '#default_value' => isset($group->name) ? check_plain($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' => isset($group->description) ? check_plain($group->description) : '',
    '#required' => TRUE,
    '#description' => t('Describe this ad group.'),
  );
  $form['weight'] = array(
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#default_value' => isset($group->weight) ? $group->weight : 0,
    '#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(),
  );
  if (isset($group->tid)) {
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
    $form['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete'),
    );
    $form['tid'] = array(
      '#type' => 'value',
      '#value' => $group->tid,
    );
  }
  else {
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Create group'),
    );
  }
  return $form;
}