Révision 7547bb19
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/modules/views_bulk_operations/actions/delete.action.inc | ||
---|---|---|
24 | 24 |
); |
25 | 25 |
} |
26 | 26 |
|
27 |
function views_bulk_operations_delete_item_views_bulk_operations_form($settings) { |
|
28 |
$form = array(); |
|
29 |
$form['log'] = array( |
|
30 |
'#type' => 'checkbox', |
|
31 |
'#title' => t('Log individual deletions'), |
|
32 |
'#description' => t('Note: Deleting large amounts of entities will generate large amounts of log messages.'), |
|
33 |
'#default_value' => !empty($settings['log']), |
|
34 |
); |
|
35 |
|
|
36 |
return $form; |
|
37 |
} |
|
38 |
|
|
27 | 39 |
function views_bulk_operations_delete_item($entity, $context) { |
28 | 40 |
$info = entity_get_info($context['entity_type']); |
29 | 41 |
$entity_id = $entity->{$info['entity keys']['id']}; |
30 | 42 |
|
31 | 43 |
entity_delete($context['entity_type'], $entity_id); |
44 |
|
|
45 |
// Add a message to the watchdog if we've been configured to do so. |
|
46 |
if (!empty($context['settings']['log'])) { |
|
47 |
// Log an appropriate message for this entity type, using the format from |
|
48 |
// the node, taxonomy and user module for their entity types. |
|
49 |
switch ($context['entity_type']) { |
|
50 |
case 'node': |
|
51 |
watchdog('content', '@type: deleted %title.', array('@type' => $entity->type, '%title' => $entity->title)); |
|
52 |
break; |
|
53 |
|
|
54 |
case 'taxonomy_term': |
|
55 |
watchdog('taxonomy', 'Deleted term %name.', array('%name' => $entity->name), WATCHDOG_NOTICE); |
|
56 |
break; |
|
57 |
|
|
58 |
case 'user': |
|
59 |
watchdog('user', 'Deleted user: %name %email.', array('%name' => $entity->name, '%email' => '<' . $entity->mail . '>'), WATCHDOG_NOTICE); |
|
60 |
break; |
|
61 |
|
|
62 |
default: |
|
63 |
watchdog('entity', 'Deleted @type %label.', array('@type' => $context['entity_type'], '%label' => entity_label($context['entity_type'], $entity))); |
|
64 |
break; |
|
65 |
} |
|
66 |
} |
|
32 | 67 |
} |
33 | 68 |
|
34 | 69 |
function views_bulk_operations_delete_revision($entity, $context) { |
Formats disponibles : Unified diff
Weekly update of contrib modules