function _linkchecker_isdefaultrevision in Link checker 7
Checks if this entity is the default revision (published).
Parameters
object $entity: The entity object, e.g., $node.
Return value
bool TRUE if the entity is the default revision, FALSE otherwise.
2 calls to _linkchecker_isdefaultrevision()
- linkchecker_node_insert in ./
linkchecker.module - Implements hook_node_insert().
- linkchecker_node_update in ./
linkchecker.module - Implements hook_node_update().
File
- ./
linkchecker.module, line 2647 - This module periodically check links in given node types, blocks etc.
Code
function _linkchecker_isdefaultrevision($entity) {
// D7 "Forward revisioning" is complex and causes a node_save() with the
// future node in node table. This fires hook_node_update() twice and cause
// abnormal behaviour in linkchecker.
//
// The steps taken by Workbench Moderation is to save the forward revision
// first and overwrite this with the live version in a shutdown function in
// a second step. This will confuse linkchecker. D7 has no generic property
// in the node object, if the node that is updated is the 'published' version
// or only a draft of a future version.
//
// This behaviour will change in D8 where $node->isDefaultRevision has been
// introduced. See below links for more details.
// - https://drupal.org/node/1879482
// - https://drupal.org/node/218755
// - https://drupal.org/node/1522154
//
// Every moderation module saving a forward revision needs to return FALSE.
// @todo: Refactor this workaround under D8.
// Workbench Moderation module.
if (module_exists('workbench_moderation') && workbench_moderation_node_type_moderated($entity->type) === TRUE && empty($entity->workbench_moderation['updating_live_revision'])) {
return FALSE;
}
return TRUE;
}