-
Notifications
You must be signed in to change notification settings - Fork 5
/
diff.module
736 lines (680 loc) · 22.4 KB
/
diff.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
<?php
/**
* @file
* Provides functionality to show a diff between two node revisions.
*/
/**
* Number of items on one page of the revision list.
*/
define('REVISION_LIST_SIZE', 50);
/**
* Exposed sorting options.
*
* No sorting means sorting by delta value for fields.
*/
define('DIFF_SORT_NONE', '0');
/**
* Exposed sorting options.
*
* This normally sorts by the rendered comparison.
*/
define('DIFF_SORT_VALUE', '1');
/**
* Exposed sorting options.
*
* It is up to the field / entity to decide how to handle the sort.
*/
define('DIFF_SORT_CUSTOM', '-1');
/**
* The various states that are available.
*/
function diff_available_states($entity_type = NULL) {
$states = array(
// Right now there is only one render mode.
// See https://github.com/backdrop-contrib/diff/issues/20
'raw' => t('Standard'),
);
return $states;
}
/**
* Implements hook_menu().
*
* @todo: Review this.
*/
function diff_menu() {
/*
* By using MENU_LOCAL_TASK (and 'tab_parent') we can get the various
* revision-views to show the View|Edit|Revision-tabs of the node on top,
* and have the Revisions-tab open. To avoid creating/showing any extra tabs
* or sub-tabs (tasks below top level) for the various paths (i.e. "Diff",
* "Show latest" and "Show a specific revision") that need a revision-id (vid)
* parameter, we make sure to set 'tab_parent' a bit odd. This solution may
* not be the prettiest one, but by avoiding having two _LOCAL_TASKs sharing
* a parent that can be accessed by its full path, it seems to work as
* desired. Breadcrumbs work decently, at least the node link is among the
* crumbs. For some reason any breadcrumbs "before/above" the node is only
* seen at 'node/%node/revisions/%/view'.
*/
// Not used directly, but was created to get the other menu items to work.
$items['node/%node/revisions/list'] = array(
'title' => 'List revisions',
'page callback' => 'diff_diffs_overview',
'type' => MENU_DEFAULT_LOCAL_TASK,
'access callback' => 'diff_node_revision_access',
'access arguments' => array(1),
'file' => 'diff.pages.inc',
);
$items['node/%node/revisions/view'] = array(
'title' => 'Compare revisions',
'page callback' => 'diff_diffs_show',
'page arguments' => array(1, 4, 5, 6),
'type' => MENU_LOCAL_TASK,
'access callback' => 'diff_node_revision_access',
'access arguments' => array(1),
'tab_parent' => 'node/%/revisions/list',
'file' => 'diff.pages.inc',
);
$items['node/%node/revisions/view/latest'] = array(
'title' => 'Show latest difference',
'page callback' => 'diff_latest',
'page arguments' => array(1),
'type' => MENU_LOCAL_TASK,
'access arguments' => array('access content'),
'tab_parent' => 'node/%/revisions/view',
'file' => 'diff.pages.inc',
);
// Administrative settings.
$items['admin/config/content/diff'] = array(
'title' => 'Diff',
'description' => 'Diff settings.',
'file' => 'diff.admin.inc',
'page callback' => 'backdrop_get_form',
'page arguments' => array('diff_admin_settings'),
'access arguments' => array('administer site configuration'),
);
$items['admin/config/content/diff/settings'] = array(
'title' => 'Settings',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/config/content/diff/fields'] = array(
'title' => 'Fields',
'description' => 'Field support and settings overview.',
'file' => 'diff.admin.inc',
'page callback' => 'diff_admin_field_overview',
'access arguments' => array('administer site configuration'),
'type' => MENU_LOCAL_TASK,
);
$items['admin/config/content/diff/fields/%'] = array(
'title' => 'Global field settings',
'page callback' => 'backdrop_get_form',
'page arguments' => array('diff_admin_global_field_settings', 5),
'access arguments' => array('administer site configuration'),
'type' => MENU_VISIBLE_IN_BREADCRUMB,
'file' => 'diff.admin.inc',
);
$items['admin/config/content/diff/entities'] = array(
'title' => 'Entities',
'description' => 'Entity settings.',
'file' => 'diff.admin.inc',
'page callback' => 'backdrop_get_form',
'page arguments' => array('diff_admin_global_entity_settings', 'node'),
'access arguments' => array('administer site configuration'),
'type' => MENU_LOCAL_TASK,
);
$items['admin/config/content/diff/entities/node'] = array(
'title' => 'Nodes',
'description' => 'Node comparison settings.',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/config/content/diff/entities/user'] = array(
'title' => 'Users',
'description' => 'User diff settings.',
'file' => 'diff.admin.inc',
'page callback' => 'backdrop_get_form',
'page arguments' => array('diff_admin_global_entity_settings', 'user'),
'access arguments' => array('administer site configuration'),
'type' => MENU_LOCAL_TASK,
);
return $items;
}
/**
* Implements hook_menu_alter().
*/
function diff_menu_alter(&$callbacks) {
// Overwrite the default 'Revisions' page.
$callbacks['node/%node/revisions']['page callback'] = 'diff_diffs_overview';
$callbacks['node/%node/revisions']['module'] = 'diff';
$callbacks['node/%node/revisions']['file'] = 'diff.pages.inc';
$callbacks['node/%node/revisions/%/view']['tab_parent'] = 'node/%/revisions/list';
$callbacks['node/%node/revisions/%/revert']['tab_parent'] = 'node/%/revisions/%/view';
$callbacks['node/%node/revisions/%/delete']['tab_parent'] = 'node/%/revisions/%/view';
$callbacks['node/%node/revisions']['access callback']
= $callbacks['node/%node/revisions/%/view']['access callback']
= $callbacks['node/%node/revisions/%/revert']['access callback']
= $callbacks['node/%node/revisions/%/delete']['access callback'] = 'diff_node_revision_access';
}
/**
* Implements hook_admin_paths_alter().
*/
function diff_admin_paths_alter(&$paths) {
// By default, treat all diff pages as administrative.
if (config_get('diff.settings', 'diff_admin_path.node')) {
$paths['node/*/revisions/view'] = TRUE;
$paths['node/*/revisions/view/*/*'] = TRUE;
}
}
/**
* Access callback for the node revisions page.
*/
function diff_node_revision_access($node, $op = 'view') {
$may_revision_this_type = config_get("node.type.$node->type", 'settings.diff_enable_revisions_page_node') || user_access('view revisions');
return $may_revision_this_type && _node_revision_access($node, $op);
}
/**
* Implements hook_hook_info().
*/
function diff_hook_info() {
$hooks['entity_diff'] = array(
'group' => 'diff',
);
$hooks['diff'] = array(
'group' => 'diff',
);
$hooks['field_diff_view_prepare_alter'] = array(
'group' => 'diff',
);
$hooks['field_diff_view_alter'] = array(
'group' => 'diff',
);
return $hooks;
}
/**
* Implements hook_entity_info_alter().
*
* Although the module only provides an UI for comparing nodes, it has an
* extendable API for any entity, so we supply two view modes for all entities.
* - diff_standard: This view mode is used to tell the module how to compare
* individual fields. This is used on the revisions page.
*/
function diff_entity_info_alter(&$entity_info) {
foreach (array_keys($entity_info) as $entity_type) {
if (!empty($entity_info[$entity_type]['view modes'])) {
$entity_info[$entity_type]['view modes'] += array(
'diff_standard' => array(
'label' => t('Revision comparison'),
'custom settings' => FALSE,
),
);
}
}
}
/**
* Implements hook_block_info().
*/
function diff_block_info() {
return array(
'inline' => array(
'info' => t('Inline differences'),
'description' => t('Display recent revisions on this page.'),
),
);
}
/**
* Implements hook_block_configure().
*/
function diff_block_configure($delta = '') {
$form = array();
switch ($delta) {
case 'inline':
$form['bundles'] = array(
'#type' => 'checkboxes',
'#title' => t('Enabled content types'),
'#default_value' => config_get('diff.settings', 'diff_show_diff_inline_node_bundles'),
'#options' => node_type_get_names(),
'#description' => t('Show this block only on pages that display content of the given type(s).'),
);
break;
}
return $form;
}
/**
* Implements hook_block_save().
*/
function diff_block_save($delta = '', $edit = array()) {
switch ($delta) {
case 'inline':
config_set('diff.settings', 'diff_show_diff_inline_node_bundles', $edit['bundles']);
break;
}
}
/**
* Implements hook_block_view().
*/
function diff_block_view($delta) {
/* @var Node $node */
if ($delta === 'inline' && user_access('view revisions') && ($node = menu_get_object()) && arg(2) !== 'edit') {
$enabled_types = config_get('diff.settings', 'diff_show_diff_inline_node_bundles');
if (!empty($enabled_types[$node->type])) {
$block = array();
$revisions = node_revision_list($node);
if (count($revisions) > 1) {
$block['subject'] = t('Highlight changes');
$block['content'] = backdrop_get_form('diff_inline_form', $node, $revisions);
}
return $block;
}
}
return NULL;
}
/**
* Implements hook_node_view_alter().
*/
function diff_node_view_alter(&$build) {
$node = $build['#node'];
if (user_access('view revisions') && in_array($node->type, config_get('diff.settings', 'diff_show_diff_inline_node_bundles'), TRUE)) {
// Ugly but cheap way to check that we are viewing a node's revision page.
if (arg(2) === 'revisions' && arg(3) === $node->vid) {
module_load_include('inc', 'diff', 'diff.pages');
$old_vid = _diff_get_previous_vid(node_revision_list($node), $node->vid);
$build = array('#markup' => diff_inline_show($node, $old_vid));
}
$build['#prefix'] = isset($build['#prefix']) ? "<div id='diff-inline-{$node->nid}'>" . $build['#prefix'] : "<div id='diff-inline-{$node->nid}'>";
$build['#suffix'] = isset($build['#suffix']) ? $build['#suffix'] . "</div>" : "</div>";
}
}
/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
function diff_form_node_form_alter(&$form, $form_state) {
// Add a 'View changes' button on the node edit form.
$node = $form['#node'];
if (config_get("node.type.$node->type", 'settings.diff_show_preview_changes_node') && !empty($node->nid)) {
$form['actions']['preview_changes'] = array(
'#type' => 'submit',
'#value' => t('View changes'),
'#weight' => 12,
'#submit' => array('diff_node_form_build_preview_changes'),
);
}
}
/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
function diff_form_node_type_form_alter(&$form, $form_state) {
if (isset($form['type'])) {
$type = $form['#node_type'];
// Add to the settings for this type of node if none set.
if (!isset($type->settings['diff_show_preview_changes_node'])) {
$type->settings['diff_show_preview_changes_node'] = 0;
$type->settings['diff_enable_revisions_page_node'] = 0;
$type->settings['diff_view_mode_preview_node'] = ' ';
}
$settings = $type->settings;
$form['diff'] = array(
'#title' => t('Compare revisions'),
'#type' => 'fieldset',
'#group' => 'additional_settings',
'#tree' => FALSE,
);
$form['diff']['diff_show_preview_changes_node'] = array(
'#type' => 'checkbox',
'#title' => t('Show <em>View changes</em> button on node edit form'),
'#weight' => 10,
'#default_value' => $settings['diff_show_preview_changes_node'],
);
$form['diff']['diff_enable_revisions_page_node'] = array(
'#type' => 'checkbox',
'#title' => t('Enable the <em>Revisions</em> page for this content type'),
'#weight' => 11,
'#default_value' => $settings['diff_enable_revisions_page_node'],
);
$options = array();
$info = entity_get_info('node');
foreach ($info['view modes'] as $view_mode => $view_mode_info) {
$options[$view_mode] = $view_mode_info['label'];
}
$form['diff']['diff_view_mode_preview_node'] = array(
'#type' => 'select',
'#title' => t('Standard comparison preview'),
'#description' => t('Governs the <em>Current revision</em> view mode when doing standard comparisons.'),
'#options' => $options,
'#weight' => 13,
'#default_value' => $settings['diff_view_mode_preview_node'],
'#empty_value' => '',
'#empty_option' => t('- Do not display -'),
);
}
}
/**
* Implements hook_node_type_update().
*
* This tracks the diff settings in case the node content type is renamed.
*/
function diff_node_type_update($info) {
if (!empty($info->old_type) && $info->old_type != $info->type) {
$type_variables = array(
'diff_show_preview_changes_node',
'diff_enable_revisions_page_node',
'diff_view_mode_preview_node',
);
foreach ($type_variables as $suffix) {
$old_filename = 'node.type.' . $info->old_type;
$new_filename = 'node.type.' . $info->type;
$setting = config_get($old_filename, "settings.$suffix");
if (isset($setting)) {
config_set($new_filename, "settings.$suffix", $setting);
}
}
// Block settings are combined in a single variable.
$inline_block_types = config_get('diff.settings', 'diff_show_diff_inline_node_bundles');
if (isset($inline_block_types[$info->old_type])) {
if (!empty($inline_block_types[$info->old_type])) {
$inline_block_types[$info->type] = $info->type;
}
unset($inline_block_types[$info->old_type]);
config_set('diff.settings', 'diff_show_diff_inline_node_bundles', $inline_block_types);
}
}
}
/**
* Implements hook_node_type_delete().
*/
function diff_node_type_delete($info) {
$node_type = $info->type;
config_clear('diff.settings',"diff_show_diff_inline_node_bundles.$node_type");
}
/**
* Submit handler for the 'View changes' action.
*
* @see node_form_build_preview()
*/
function diff_node_form_build_preview_changes($form, &$form_state) {
module_load_include('inc', 'diff', 'diff.pages');
$old_node = clone node_load($form_state['values']['nid']);
$node = node_form_submit_build_node($form, $form_state);
// Create diff of old node and edited node.
$state = config_get('diff.settings','diff_default_state_node');
$rows = _diff_body_rows($old_node, $node, $state);
$header = _diff_default_header(t('Original'), t('Changes'));
$changes = theme('table__diff__preview', array(
'header' => $header,
'rows' => $rows,
'attributes' => array('class' => array('diff')),
'colgroups' => _diff_default_cols(),
'sticky' => FALSE,
));
// Prepend diff to edit form.
$form_state['node_preview'] = $changes;
$form_state['rebuild'] = TRUE;
}
/**
* Implements hook_theme().
*/
function diff_theme() {
return array(
'diff_node_revisions' => array(
'render element' => 'form',
'file' => 'diff.theme.inc',
),
'diff_header_line' => array(
'arguments' => array('lineno' => NULL),
'file' => 'diff.theme.inc',
),
'diff_content_line' => array(
'arguments' => array('line' => NULL),
'file' => 'diff.theme.inc',
),
'diff_empty_line' => array(
'arguments' => array('line' => NULL),
'file' => 'diff.theme.inc',
),
'diff_inline_form' => array(
'render element' => 'form',
'file' => 'diff.theme.inc',
),
'diff_inline_metadata' => array(
'arguments' => array('node' => NULL),
'file' => 'diff.theme.inc',
),
'diff_inline_chunk' => array(
'arguments' => array('text' => '', 'type' => NULL),
'file' => 'diff.theme.inc',
),
);
}
/**
* Render the table rows for theme('table').
*
* @param string $a
* The source string to compare from.
* @param string $b
* The target string to compare to.
* @param boolean $show_header
* Display diff context headers. For example, "Line x".
* @param array $line_stats
* This structure tracks line numbers across multiple calls to DiffFormatter.
*
* @return array
* Array of rows usable with theme('table').
*/
function diff_get_rows($a, $b, $show_header = FALSE, &$line_stats = NULL) {
$a = is_array($a) ? $a : explode("\n", $a);
$b = is_array($b) ? $b : explode("\n", $b);
if (!isset($line_stats)) {
$line_stats = array(
'counter' => array('x' => 0, 'y' => 0),
'offset' => array('x' => 0, 'y' => 0),
);
}
$formatter = new BackdropDiffFormatter();
// Header is the line counter.
// @todo: The core BackdropDiffFormatter does not allow setting these private
// property values directly.
//$formatter->show_header = $show_header;
//$formatter->line_stats = &$line_stats;
$diff = new Diff($a, $b);
return $formatter->format($diff);
}
/**
* Render and markup a diff of two strings into HTML markup.
*
* @param string $a
* The source string to compare from.
* @param string $b
* The target string to compare to.
*
* @return string
* String containing HTML markup.
*/
function diff_get_inline($a, $b) {
$diff = new BackdropDiffInline($a, $b);
return $diff->render();
}
/**
* Form builder: Inline diff controls.
*/
function diff_inline_form($form, $form_state, $node, $revisions) {
$form = array();
$form['node'] = array(
'#type' => 'value',
'#value' => $node,
);
$form['revision'] = array(
'#type' => 'select',
'#options' => array(0 => t('- No highlighting -')),
'#default_value' => (arg(2) === 'revisions' && arg(3) === $node->vid) ? $node->vid : 0,
'#ajax' => array(
'callback' => 'diff_inline_ajax',
'wrapper' => "node-{$node->nid}",
'method' => 'replace',
),
);
foreach ($revisions as $revision) {
$form['revision']['#options'][$revision->vid] = t('@revision by @name', array(
'@revision' => format_date($revision->timestamp, 'short'),
'@name' => user_format_name($revision),
));
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('View'),
'#submit' => array('diff_inline_form_submit'),
'#attributes' => array('class' => array('diff-js-hidden')),
);
return $form;
}
/**
* AJAX callback for rendering the inline diff of a node.
*/
function diff_inline_ajax($form, $form_state) {
module_load_include('inc', 'diff', 'diff.pages');
$node = $form['node']['#value'];
$vid = isset($form_state['values']['revision']) ? $form_state['values']['revision'] : 0;
return "<div id='node-{$node->nid}'>" . diff_inline_show($node, $vid) . "</div>";
}
/**
* Form submission handler for diff_inline_form() for JS-disabled clients.
*/
function diff_inline_form_submit(&$form, &$form_state) {
if (isset($form_state['values']['revision'], $form_state['values']['node'])) {
$node = $form_state['values']['node'];
$vid = $form_state['values']['revision'];
$form_state['redirect'] = "node/{$node->nid}/revisions/{$vid}/view";
}
}
/**
* A helper function to normalise system differences.
*
* This handles differences in:
* - line endings: Mac, Windows and UNIX all use different line endings.
*/
function diff_normalise_text($text) {
$text = str_replace(array("\r\n", "\r"), "\n", $text);
return $text;
}
/**
* A wrapper function for filter_xss() to exclude all tags.
*/
function diff_filter_xss($string) {
return filter_xss($string, array());
}
/**
* Helper function to load any CSS or JScript files required by a page or form.
*/
function diff_build_attachments($jscript = FALSE) {
$attachments = array();
$theme = config_get('diff.settings', 'diff_theme');
if ($theme) {
$attachments['css'] = array(
backdrop_get_path('module', 'diff') . "/css/diff.{$theme}.css",
);
}
$type = config_get('diff.settings', 'diff_radio_behavior');
if ($jscript && $type) {
$attachments['js'] = array(
backdrop_get_path('module', 'diff') . "/js/diff.js",
array(
'data' => array('diffRevisionRadios' => $type),
'type' => 'setting',
),
);
}
return $attachments;
}
/**
* Implements hook_entity_diff() on behalf of the Node module.
*/
function node_entity_diff($old_node, $new_node, $context) {
$result = array();
if ($context['entity_type'] == 'node') {
module_load_include('inc', 'diff', 'includes/node');
$options = config_get('diff.settings', 'diff_additional_options.node');
foreach (node_entity_diff_options('node') as $key => $option_label) {
if (!empty($options[$key])) {
$func = '_node_entity_diff_additional_options_' . $key;
$result[$key] = $func($old_node, $new_node, $context);
}
}
}
return $result;
}
/**
* Implements hook_entity_diff_options() on behalf of the Node module.
*/
function node_entity_diff_options($entity_type) {
if ($entity_type == 'node') {
$options = array(
'title' => t('Title field'),
// Author field is either the owner or revision creator, neither capture
// a change in the author field.
'author' => t('Author'),
'revision_author' => t('Revision author'),
'type' => t('Node type'),
'publishing_flags' => t('Publishing options'),
// More fields that currently can not be tracked.
'created' => t('Created date'),
'changed' => t('Updated date'),
'revision_timestamp' => t('Revision timestamp'),
);
if (module_exists('comment')) {
$options['comment'] = t('Comment setting');
}
return $options;
}
return NULL;
}
/**
* Implements hook_entity_diff() on behalf of the User module.
*/
function user_entity_diff($old_user, $new_user, $context) {
$result = array();
if ($context['entity_type'] == 'user') {
module_load_include('inc', 'diff', 'includes/user');
$options = config_get('diff.settings', 'diff_additional_options.user');
foreach (user_entity_diff_options('user') as $key => $option_label) {
if (!empty($options[$key])) {
$func = '_user_entity_diff_additional_options_' . $key;
$result[$key] = $func($old_user, $new_user, $context);
}
}
}
return $result;
}
/**
* Implements hook_entity_diff_options() on behalf of the User module.
*/
function user_entity_diff_options($entity_type) {
if ($entity_type == 'user') {
$options = array(
'name' => t('Username'),
'mail' => t('E-mail address'),
'roles' => t('Roles'),
'status' => t('Status'),
'timezone' => t('Time zone'),
'password' => t('Password Hash'),
);
return $options;
}
return NULL;
}
/**
* Implements hook_config_info().
*/
function diff_config_info() {
$prefixes['diff.settings'] = array(
'label' => t('Diff'),
'group' => t('Configuration'),
);
return $prefixes;
}
/**
* Implements hook_autoload_info().
*/
function diff_autoload_info()
{
return array(
'BackdropDiffInline' => 'includes/diff.backdrop_diff_inline.inc',
);
}