You are here

function modr8_form in modr8 7

Same name and namespace in other branches
  1. 5 modr8_admin.inc \modr8_form()
  2. 6 modr8_admin.inc \modr8_form()

Content moderation form.

1 string reference to 'modr8_form'
modr8_page in ./modr8_admin.inc
Menu callback; displays the content moderation form.

File

./modr8_admin.inc, line 278
Admin pages for moderation

Code

function modr8_form($form, $form_state, $nid_list = array()) {
  $form = array(
    '#theme' => 'modr8_form',
    '#tree' => TRUE,
  );
  foreach ($nid_list as $nid) {
    $op_options = array();
    $node = node_load($nid);

    // This flag can be used by modr8, or other modules to change the teaser specifically
    // for when it's being shown in the moderation list.
    $node->modr8_form_teaser = TRUE;
    $node->build_mode = NODE_BUILD_MODR8_TEASER;
    $teaser = modr8_get_node_teaser($node);
    $form[$node->nid] = array(
      '#tree' => TRUE,
    );
    $op_options['approve'] = t('Approve');
    if (node_access("delete", $node)) {
      $op_options['delete'] = t('Delete');
    }
    $op_options['nada'] = t('No action');
    $form[$node->nid]['ops'] = array(
      '#type' => 'radios',
      '#options' => $op_options,
      '#default_value' => variable_get('modr8_default_option', 'nada'),
    );
    if (variable_get('modr8_send_approve', FALSE) || variable_get('modr8_send_deny', FALSE)) {
      $form[$node->nid]['note'] = array(
        '#type' => 'textarea',
        '#title' => t('Note to author'),
        '#cols' => 15,
      );
    }
    $form[$node->nid]['preview'] = array(
      '#type' => 'value',
      '#value' => $teaser,
    );
    $form[$node->nid]['log_link'] = array(
      '#markup' => modr8_get_log_link($node),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}