You are here

function freelinking_multiple_delete_confirm in Freelinking 5

Same name and namespace in other branches
  1. 6 freelinking.module \freelinking_multiple_delete_confirm()
  2. 6.2 freelinking.module \freelinking_multiple_delete_confirm()
1 string reference to 'freelinking_multiple_delete_confirm'
freelinking_page in ./freelinking.module

File

./freelinking.module, line 166

Code

function freelinking_multiple_delete_confirm($links = array()) {
  $form['links'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  // array_filter returns only elements with TRUE values
  foreach ($links as $hash => $value) {
    $phrase = db_result(db_query('SELECT phrase FROM {freelinking} WHERE hash = "%s"', $hash));
    $form['links'][$hash] = array(
      '#type' => 'hidden',
      '#value' => $hash,
      '#prefix' => '<li>',
      '#suffix' => check_plain($phrase) . "</li>\n",
    );
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'delete',
  );
  return confirm_form($form, t('Are you sure you want to delete these items?'), 'freelinking', t('This action cannot be undone.'), t('Delete all'), t('Cancel'));
}