function certificate_admin_clear_form_submit in Certificate 4.x
Same name and namespace in other branches
- 8.3 certificate.admin.inc \certificate_admin_clear_form_submit()
- 6.2 certificate.admin.inc \certificate_admin_clear_form_submit()
- 6 certificate.admin.inc \certificate_admin_clear_form_submit()
- 7.2 certificate.admin.inc \certificate_admin_clear_form_submit()
- 3.x certificate.admin.inc \certificate_admin_clear_form_submit()
Delete selected certificate snapshots.
File
- ./
certificate.admin.inc, line 108 - Administrative pages for Certificate module.
Code
function certificate_admin_clear_form_submit(&$form, &$form_state) {
$nids = array();
foreach ($form_state['values']['nids'] as $nid => $delete) {
if ($delete) {
$nids[] = $nid;
}
}
if (count($nids)) {
// TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
// You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
\Drupal::database()
->delete('certificate_snapshots')
->condition('nid', $nids, 'IN')
->execute();
\Drupal::messenger()
->addStatus(t('Cleared certificate snapshots.'));
}
else {
\Drupal::messenger()
->addError(t('No items selected.'));
}
}