You are here

function heartbeat_messages_multiple_delete_confirm in Heartbeat 6.4

List the selected activitymessages and verify that the admin really wants to delete them.

Parameters

$form_state: An associative array containing the current state of the form.

Return value

TRUE if the messages should be deleted, FALSE otherwise.

See also

heartbeat_messages_multiple_delete_confirm_submit()

1 string reference to 'heartbeat_messages_multiple_delete_confirm'
heartbeat_activity_admin in ./heartbeat.admin.inc
Callback menu page for heartbeat content administration.

File

./heartbeat.admin.inc, line 154
Admnistration tasks for heartbeat.

Code

function heartbeat_messages_multiple_delete_confirm(&$form_state) {
  $edit = $form_state['post'];
  $form['heartbeat-activity'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  // array_filter() returns only elements with actual values
  $counter = 0;
  foreach (array_filter($edit['heartbeat-activity']) as $uaid => $value) {
    $activity = heartbeat_load_message_instance($uaid);
    $form['heartbeat-activity'][$uaid] = array(
      '#type' => 'hidden',
      '#value' => $uaid,
      '#prefix' => '<li>',
      '#suffix' => check_plain(strip_tags($activity->message)) . '</li>',
    );
    $counter++;
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'delete',
  );
  if (!$counter) {
    drupal_set_message(t('There do not appear to be any messages to delete or your selected message was deleted by another administrator.'));
    drupal_goto('admin/content/heartbeat');
  }
  else {
    return confirm_form($form, t('Are you sure you want to delete these messages and all their attachments?'), 'admin/content/heartbeat', t('This action cannot be undone.'), t('Delete activity messages'), t('Cancel'));
  }
}