You are here

function shoutbox_edit_form in Shoutbox 7.2

Same name and namespace in other branches
  1. 5 shoutbox.module \shoutbox_edit_form()
  2. 6.2 shoutbox.pages.inc \shoutbox_edit_form()
  3. 6 shoutbox.module \shoutbox_edit_form()
  4. 7 shoutbox.pages.inc \shoutbox_edit_form()

Form for editing shouts.

Parameters

shout_id: The shout id of the shout being edited.

1 string reference to 'shoutbox_edit_form'
shoutbox_menu in ./shoutbox.module
Implements hook_menu().

File

./shoutbox.pages.inc, line 408
Page callbacks for the shoutbox module.

Code

function shoutbox_edit_form($form, &$form_state, $shout) {
  global $user;
  $form[] = array(
    '#type' => 'item',
    '#title' => t('Author'),
    '#markup' => l($shout->nick, 'user/' . $shout->uid),
  );
  $form[] = array(
    '#type' => 'item',
    '#title' => t('Created'),
    '#markup' => date('m/d/y h:i:sa', $shout->created),
  );
  $form[] = array(
    '#type' => 'item',
    '#title' => t('Changed'),
    '#markup' => date('m/d/y h:i:sa', $shout->changed),
  );
  if (_shoutbox_user_access('administer shoutbox') || _shoutbox_user_access('moderate shoutbox')) {
    $form['moderate'] = array(
      '#type' => 'radios',
      '#title' => t('Moderation status'),
      '#default_value' => $shout->moderate,
      '#options' => array(
        'published',
        'not published',
      ),
    );
  }
  if (_shoutbox_user_access('edit own shouts', $shout)) {
    $max = variable_get('shoutbox_max_length', 255);
    $form['shout'] = array(
      '#type' => variable_get('shoutbox_widget_type', 'textfield'),
      '#title' => t('Shout'),
      '#default_value' => $shout->shout,
      '#cols' => 13,
      '#required' => TRUE,
      '#rows' => 7,
      '#maxlength' => $max ? $max : NULL,
    );
    $form['shout_id'] = array(
      '#type' => 'value',
      '#value' => $shout->shout_id,
    );
  }
  $path = drupal_get_destination();
  $path = $path['destination'];
  $form = confirm_form($form, '', $path, '', t('Update'), t('Cancel'));
  return $form;
}