You are here

function revisioning_content_is_moderated in Revisioning 7

Same name and namespace in other branches
  1. 8 revisioning_api.inc \revisioning_content_is_moderated()

Return whether the supplied content type is subject to moderation.

Parameters

string $content_type: i.e. machine name, ie. $node->type

object $node: (optional) argument to implement "moderation opt-in" for nodes that are not moderated by default (i.e by their content type).

Return value

bool TRUE, if the supplied type has the "New revision in draft, pending moderation" box ticked on the Structure >> Content types >> edit page OR when a pending revision exists. The latter is to support the feature of "moderate at any time" available to users with the "administer nodes" permission.

8 calls to revisioning_content_is_moderated()
revisioning_form_alter in ./revisioning.pages.inc
Implements hook_form_alter().
revisioning_get_revisions in ./revisioning_api.inc
Get list of revisions accessible to the logged-in user via the operation.
revisioning_handler_field_node_revision_moderation::render in views/revisioning_handler_field_node_revision_moderation.inc
Render the data.
revisioning_moderated_content_types in ./revisioning_api.inc
Return an array of names of content types that are subject to moderation.
revisioning_permission in ./revisioning.module
Implements hook_permission().

... See full list

File

./revisioning_api.inc, line 180
API functions of Revisioning module

Code

function revisioning_content_is_moderated($content_type, $node = NULL) {
  $content_type_is_moderated = !empty($content_type) && in_array('revision_moderation', variable_get('node_options_' . $content_type, array()));
  if (!$content_type_is_moderated && isset($node->nid) && isset($node->current_revision_id)) {
    $latest_vid = revisioning_get_latest_revision_id($node->nid);
    return $latest_vid > $node->current_revision_id;
  }
  return $content_type_is_moderated;
}