public function PanelizerEntityNode::entity_allows_revisions in Panelizer 7.3
Same name and namespace in other branches
- 7.2 plugins/entity/PanelizerEntityNode.class.php \PanelizerEntityNode::entity_allows_revisions()
Determine if the entity allows revisions.
Overrides PanelizerEntityDefault::entity_allows_revisions
File
- plugins/
entity/ PanelizerEntityNode.class.php, line 54 - Class for the Panelizer node entity plugin.
Class
- PanelizerEntityNode
- Panelizer Entity node plugin class.
Code
public function entity_allows_revisions($entity) {
$retval = array();
list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
$node_options = variable_get('node_options_' . $bundle, array(
'status',
'promote',
'panelizer',
));
// Whether or not the entity supports revisions. Drupal core supports
// revisions by default on nodes; if Workbench Moderation is enabled it's
// possible to disable this.
$retval[0] = TRUE;
if (module_exists('workbench_moderation')) {
$retval[0] = in_array('panelizer', $node_options);
}
// Whether or not the user can control if a revision is created.
$retval[1] = user_access('administer nodes');
// Whether or not the revision is created by default.
$retval[2] = in_array('revision', $node_options);
return $retval;
}