You are here

function hook_entity_diff_alter in Diff 7.3

Allow modules to alter a comparison about entities.

Parameters

array $entity_diffs: An array of entity differences.

array $context: An associative array containing:

  • entity_type: The entity type; e.g., 'node' or 'user'.
  • old_entity: The older entity.
  • new_entity: The newer entity.
  • view_mode: The view mode to use. Defaults to FALSE.

See also

hook_entity_diff()

File

./diff.api.php, line 110
Hooks provided by the diff module.

Code

function hook_entity_diff_alter(&$entity_diffs, $context) {
  if ($context['entity_type'] == 'node') {
    $old_entity = $context['old_entity'];
    $new_entity = $context['new_entity'];
    $entity_diffs['custom_vid'] = array(
      '#name' => t('Second VID'),
      '#old' => array(
        $old_entity->vid,
      ),
      '#new' => array(
        $new_entity->vid,
      ),
      '#weight' => 5,
    );
    $entity_diffs['custom_log'] = array(
      '#name' => t('Second log'),
      '#old' => array(
        $old_entity->log,
      ),
      '#new' => array(
        $new_entity->log,
      ),
      '#weight' => 6,
    );
  }
}