You are here

function biblio_admin_orphans_form_submit in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 includes/biblio.admin.inc \biblio_admin_orphans_form_submit()
  2. 6 biblio.admin.inc \biblio_admin_orphans_form_submit()
  3. 7.2 includes/biblio.admin.inc \biblio_admin_orphans_form_submit()

_state

Parameters

$form:

1 string reference to 'biblio_admin_orphans_form_submit'
biblio_admin_orphans_form in includes/biblio.admin.inc
_state

File

includes/biblio.admin.inc, line 2688
biblio.admin.inc

Code

function biblio_admin_orphans_form_submit($form, &$form_state) {
  $authors = $names = array();

  // Filter out unchecked authors.
  if ($form_state['triggering_element']['#value'] == t('Delete Selected')) {
    $authors = array_filter($form_state['values']['authors']);
  }
  elseif ($form_state['triggering_element']['#value'] == t('Delete ALL')) {
    $authors = drupal_map_assoc(array_keys($form_state['values']['authors']));
  }
  $names = array_intersect_key($form_state['values']['names'], $authors);
  $del_names = implode('; ', $names);
  db_delete('biblio_contributor_data')
    ->condition('cid', $authors, 'IN')
    ->execute();
  drupal_set_message(t('The orphaned authors (@author_list) have been deleted.', array(
    '@author_list' => $del_names,
  )));
}